Skip to content

Commit

Permalink
add amazonbedrock, change model list to const var
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensu1977 committed Oct 19, 2023
1 parent dd19ad8 commit f9f7eee
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pkg/ai/amzonbedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,30 @@ type InvokeModelResponseBody struct {

const BEDROCK_REGION = "us-east-1" // default use us-east-1 region

const (
ModelAnthropicClaudeV2 = "anthropic.claude-v2"
ModelAnthropicClaudeV1 = "anthropic.claude-v1"
ModelAnthropicClaudeInstantV1 = "anthropic.claude-instant-v1"
)

var BEDROCK_MODELS = []string{
ModelAnthropicClaudeV2,
ModelAnthropicClaudeV1,
ModelAnthropicClaudeInstantV1,
}

// GetModelOrDefault check config model
func GetModelOrDefault(model string) string {
modelList := []string{"anthropic.claude-v2", "anthropic.claude-v1", "anthropic.claude-instant-v1"}

// Check if the provided model is in the list
for _, m := range modelList {
for _, m := range BEDROCK_MODELS {
if m == model {
return model // Return the provided model
}
}

// Return the default model if the provided model is not in the list
return modelList[0]
return BEDROCK_MODELS[0]
}

// Configure configures the AmazonBedRockClient with the provided configuration and language.
Expand Down

0 comments on commit f9f7eee

Please sign in to comment.