feat: unify aiClientName const for all providers (#848)

This commit is contained in:
Matthis
2024-01-07 13:01:15 +01:00
committed by GitHub
parent ce4910bc5d
commit 5c17c24055
8 changed files with 29 additions and 15 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -20,6 +20,8 @@ import (
"github.com/cohere-ai/cohere-go"
)
const cohereAIClientName = "cohere"
type CohereClient struct {
nopCloser
@@ -68,5 +70,5 @@ func (c *CohereClient) GetCompletion(_ context.Context, prompt string) (string,
}
func (c *CohereClient) GetName() string {
return "cohere"
return cohereAIClientName
}

View File

@@ -29,14 +29,14 @@ var (
&GoogleGenAIClient{},
}
Backends = []string{
"openai",
"localai",
"azureopenai",
"cohere",
"amazonbedrock",
"amazonsagemaker",
openAIClientName,
localAIClientName,
azureAIClientName,
cohereAIClientName,
amazonbedrockAIClientName,
amazonsagemakerAIClientName,
googleAIClientName,
"noopai",
noopAIClientName,
}
)

View File

@@ -1,9 +1,11 @@
package ai
const localAIClientName = "localai"
type LocalAIClient struct {
OpenAIClient
}
func (a *LocalAIClient) GetName() string {
return "localai"
return localAIClientName
}

View File

@@ -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
}

View File

@@ -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
}