feat: add configuration interface to support customer providers

Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
This commit is contained in:
Aris Boutselis
2023-04-20 16:26:12 +01:00
parent bd4ab0e589
commit 84a3cc05fb
5 changed files with 31 additions and 14 deletions

View File

@@ -5,12 +5,17 @@ import (
)
type IAI interface {
Configure(token string, model string, language string) error
Configure(config IAIConfig, language string) error
GetCompletion(ctx context.Context, prompt string) (string, error)
Parse(ctx context.Context, prompt []string, nocache bool) (string, error)
GetName() string
}
type IAIConfig interface {
GetPassword() string
GetModel() string
}
func NewClient(provider string) IAI {
switch provider {
case "openai":
@@ -31,3 +36,11 @@ type AIProvider struct {
Model string `mapstructure:"model"`
Password string `mapstructure:"password"`
}
func (p *AIProvider) GetPassword() string {
return p.Password
}
func (p *AIProvider) GetModel() string {
return p.Model
}