mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-26 07:31:09 +00:00
add amazonbedrock, change model list to const var
Signed-off-by: Su Wei <suwei007@gmail.com>
This commit is contained in:
@@ -33,19 +33,30 @@ type InvokeModelResponseBody struct {
|
|||||||
|
|
||||||
const BEDROCK_REGION = "us-east-1" // default use us-east-1 region
|
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
|
// GetModelOrDefault check config model
|
||||||
func GetModelOrDefault(model string) string {
|
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
|
// Check if the provided model is in the list
|
||||||
for _, m := range modelList {
|
for _, m := range BEDROCK_MODELS {
|
||||||
if m == model {
|
if m == model {
|
||||||
return model // Return the provided model
|
return model // Return the provided model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the default model if the provided model is not in the list
|
// 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.
|
// Configure configures the AmazonBedRockClient with the provided configuration and language.
|
||||||
|
Reference in New Issue
Block a user