-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce config files, multiple backends, refactor
This commit introduces a major API change for `aiac` in both its CLI and library forms, as per feedback from the community: - `aiac` now uses a configuration file where various named backends may be defined, each targeting a specific LLM provider and environment. For example, one may configure a staging Amazon Bedrock environment, and a production environment. Users refer to these backends using the names they select for them. Command line flags such as `--api-key` and `--aws-profile` are no longer accepted and are now part of the configuration file. - `aiac` no longer hardcodes supported models for each LLM provider. Users can choose any model they want, and set a default model for each backend. The `--list-models` flag (previously the `list-models` subcommand) contacts the LLM provider's API to retrieve a list of supported models. - The `aiac` CLI is now simpler, and is no longer comprised of multiple subcommands, meaning flags such as `--model` no longer need to be provided before the "get" argument (which was actually a subcommand before), they will be accepted anywhere (outside of the actual prompt). The word "get" or "generate" no longer need to be used at all either. - `aiac` no longer errors out when the provider API response notes that the result was truncated. Apparently, this isn't always accurate. Instead, the "stop reason" returned by the API is returned to the user as part of the output. Refer to the [README.md](README.md) file for more information, including how to upgrade from a previous version. Resolves: #91, #121, #123
- Loading branch information
Showing
25 changed files
with
773 additions
and
1,067 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package bedrock | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go-v2/aws" | ||
"github.com/aws/aws-sdk-go-v2/service/bedrock" | ||
"github.com/aws/aws-sdk-go-v2/service/bedrockruntime" | ||
) | ||
|
||
// Bedrock is the struct that implements libaiac's Backend interface. | ||
type Bedrock struct { | ||
runtime *bedrockruntime.Client | ||
service *bedrock.Client | ||
} | ||
|
||
const ( | ||
// DefaultAWSRegion is the default AWS region to use if the backend does not | ||
// specify one | ||
DefaultAWSRegion = "us-east-1" | ||
|
||
// DefaultAWSProfile is the default AWS profile to use if the backend does | ||
// not specify one | ||
DefaultAWSProfile = "default" | ||
) | ||
|
||
// New constructs a new Bedrock object. It receives a standard aws.Config | ||
// object. | ||
func New(cfg aws.Config) *Bedrock { | ||
return &Bedrock{ | ||
runtime: bedrockruntime.NewFromConfig(cfg), | ||
service: bedrock.NewFromConfig(cfg), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.