Skip to content

Commit

Permalink
Use a more flexible solution to extract provider name from the model id
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaronca committed Feb 6, 2025
1 parent 0672790 commit 2dfcb70
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion llms/bedrock/internal/bedrockclient/bedrockclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,20 @@ type Message struct {
}

func getProvider(modelID string) string {
return strings.Split(modelID, ".")[0]
switch {
case strings.Contains(modelID, "ai21"):
return "ai21"
case strings.Contains(modelID, "amazon"):
return "amazon"
case strings.Contains(modelID, "anthropic"):
return "anthropic"
case strings.Contains(modelID, "cohere"):
return "cohere"
case strings.Contains(modelID, "meta"):
return "meta"
default:
return ""
}
}

// NewClient creates a new Bedrock client.
Expand Down

0 comments on commit 2dfcb70

Please sign in to comment.