mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-16 07:09:33 +00:00
feat: unify aiClientName const for all providers (#848)
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
"github.com/aws/aws-sdk-go/service/bedrockruntime"
|
||||
)
|
||||
|
||||
const amazonbedrockAIClientName = "amazonbedrock"
|
||||
|
||||
// AmazonBedRockClient represents the client for interacting with the Amazon Bedrock service.
|
||||
type AmazonBedRockClient struct {
|
||||
nopCloser
|
||||
@@ -147,5 +149,5 @@ func (a *AmazonBedRockClient) GetCompletion(ctx context.Context, prompt string)
|
||||
|
||||
// GetName returns the name of the AmazonBedRockClient.
|
||||
func (a *AmazonBedRockClient) GetName() string {
|
||||
return "amazonbedrock"
|
||||
return amazonbedrockAIClientName
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ import (
|
||||
"github.com/aws/aws-sdk-go/service/sagemakerruntime"
|
||||
)
|
||||
|
||||
const amazonsagemakerAIClientName = "amazonsagemaker"
|
||||
|
||||
type SageMakerAIClient struct {
|
||||
nopCloser
|
||||
|
||||
@@ -131,5 +133,5 @@ func (c *SageMakerAIClient) GetCompletion(_ context.Context, prompt string) (str
|
||||
}
|
||||
|
||||
func (c *SageMakerAIClient) GetName() string {
|
||||
return "amazonsagemaker"
|
||||
return amazonsagemakerAIClientName
|
||||
}
|
||||
|
@@ -7,6 +7,8 @@ import (
|
||||
"github.com/sashabaranov/go-openai"
|
||||
)
|
||||
|
||||
const azureAIClientName = "azureopenai"
|
||||
|
||||
type AzureAIClient struct {
|
||||
nopCloser
|
||||
|
||||
@@ -58,5 +60,5 @@ func (c *AzureAIClient) GetCompletion(ctx context.Context, prompt string) (strin
|
||||
}
|
||||
|
||||
func (c *AzureAIClient) GetName() string {
|
||||
return "azureopenai"
|
||||
return azureAIClientName
|
||||
}
|
||||
|
@@ -20,9 +20,11 @@ import (
|
||||
"github.com/cohere-ai/cohere-go"
|
||||
)
|
||||
|
||||
const cohereAIClientName = "cohere"
|
||||
|
||||
type CohereClient struct {
|
||||
nopCloser
|
||||
|
||||
|
||||
client *cohere.Client
|
||||
model string
|
||||
temperature float32
|
||||
@@ -68,5 +70,5 @@ func (c *CohereClient) GetCompletion(_ context.Context, prompt string) (string,
|
||||
}
|
||||
|
||||
func (c *CohereClient) GetName() string {
|
||||
return "cohere"
|
||||
return cohereAIClientName
|
||||
}
|
||||
|
@@ -29,14 +29,14 @@ var (
|
||||
&GoogleGenAIClient{},
|
||||
}
|
||||
Backends = []string{
|
||||
"openai",
|
||||
"localai",
|
||||
"azureopenai",
|
||||
"cohere",
|
||||
"amazonbedrock",
|
||||
"amazonsagemaker",
|
||||
openAIClientName,
|
||||
localAIClientName,
|
||||
azureAIClientName,
|
||||
cohereAIClientName,
|
||||
amazonbedrockAIClientName,
|
||||
amazonsagemakerAIClientName,
|
||||
googleAIClientName,
|
||||
"noopai",
|
||||
noopAIClientName,
|
||||
}
|
||||
)
|
||||
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package ai
|
||||
|
||||
const localAIClientName = "localai"
|
||||
|
||||
type LocalAIClient struct {
|
||||
OpenAIClient
|
||||
}
|
||||
|
||||
func (a *LocalAIClient) GetName() string {
|
||||
return "localai"
|
||||
return localAIClientName
|
||||
}
|
||||
|
@@ -17,6 +17,8 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const noopAIClientName = "noopai"
|
||||
|
||||
type NoOpAIClient struct {
|
||||
nopCloser
|
||||
}
|
||||
@@ -31,5 +33,5 @@ func (c *NoOpAIClient) GetCompletion(_ context.Context, prompt string) (string,
|
||||
}
|
||||
|
||||
func (c *NoOpAIClient) GetName() string {
|
||||
return "noopai"
|
||||
return noopAIClientName
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@ import (
|
||||
"github.com/sashabaranov/go-openai"
|
||||
)
|
||||
|
||||
const openAIClientName = "openai"
|
||||
|
||||
type OpenAIClient struct {
|
||||
nopCloser
|
||||
|
||||
@@ -78,5 +80,5 @@ func (c *OpenAIClient) GetCompletion(ctx context.Context, prompt string) (string
|
||||
}
|
||||
|
||||
func (c *OpenAIClient) GetName() string {
|
||||
return "openai"
|
||||
return openAIClientName
|
||||
}
|
||||
|
Reference in New Issue
Block a user