mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-12 21:34:47 +00:00
feat: add configuration interface to support customer providers
Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user