Private
Public Access
1
0

Gemini fixes, tool calling

This commit is contained in:
2024-05-18 23:18:53 +00:00
parent cbcd3b1ba9
commit 1b8d04c96d
2 changed files with 50 additions and 14 deletions

View File

@@ -8,6 +8,7 @@ import (
"git.mlow.ca/mlow/lmcli/pkg/lmcli/model"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/provider"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/provider/anthropic"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/provider/google"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/provider/openai"
"git.mlow.ca/mlow/lmcli/pkg/lmcli/tools"
"git.mlow.ca/mlow/lmcli/pkg/util"
@@ -75,21 +76,28 @@ func (c *Context) GetCompletionProvider(model string) (provider.ChatCompletionCl
if p.BaseURL != nil {
url = *p.BaseURL
}
anthropic := &anthropic.AnthropicClient{
return &anthropic.AnthropicClient{
BaseURL: url,
APIKey: *p.APIKey,
}, nil
case "google":
url := "https://generativelanguage.googleapis.com"
if p.BaseURL != nil {
url = *p.BaseURL
}
return anthropic, nil
return &google.Client{
BaseURL: url,
APIKey: *p.APIKey,
}, nil
case "openai":
url := "https://api.openai.com/v1"
if p.BaseURL != nil {
url = *p.BaseURL
}
openai := &openai.OpenAIClient{
return &openai.OpenAIClient{
BaseURL: url,
APIKey: *p.APIKey,
}
return openai, nil
}, nil
default:
return nil, fmt.Errorf("unknown provider kind: %s", *p.Kind)
}