fix: address review feedback - proper provider check and proxy support
This commit is contained in:
parent
032f107935
commit
597115817d
1 changed files with 10 additions and 3 deletions
|
|
@ -178,6 +178,11 @@ func (p *HTTPProvider) parseResponse(body []byte) (*LLMResponse, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix: skip tool calls with empty names to avoid downstream errors
|
||||||
|
if name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
toolCalls = append(toolCalls, ToolCall{
|
toolCalls = append(toolCalls, ToolCall{
|
||||||
ID: tc.ID,
|
ID: tc.ID,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
|
@ -285,7 +290,8 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
apiKey = cfg.Providers.Gemini.APIKey
|
apiKey = cfg.Providers.Gemini.APIKey
|
||||||
apiBase = cfg.Providers.Gemini.APIBase
|
apiBase = cfg.Providers.Gemini.APIBase
|
||||||
if apiBase == "" {
|
if apiBase == "" {
|
||||||
apiBase = "https://generativelanguage.googleapis.com/v1beta"
|
// Use OpenAI-compatible endpoint for tool calling support
|
||||||
|
apiBase = "https://generativelanguage.googleapis.com/v1beta/openai"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "vllm":
|
case "vllm":
|
||||||
|
|
@ -388,7 +394,8 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
apiBase = cfg.Providers.Gemini.APIBase
|
apiBase = cfg.Providers.Gemini.APIBase
|
||||||
proxy = cfg.Providers.Gemini.Proxy
|
proxy = cfg.Providers.Gemini.Proxy
|
||||||
if apiBase == "" {
|
if apiBase == "" {
|
||||||
apiBase = "https://generativelanguage.googleapis.com/v1beta"
|
// Use OpenAI-compatible endpoint for tool calling support
|
||||||
|
apiBase = "https://generativelanguage.googleapis.com/v1beta/openai"
|
||||||
}
|
}
|
||||||
|
|
||||||
case (strings.Contains(lowerModel, "glm") || strings.Contains(lowerModel, "zhipu") || strings.Contains(lowerModel, "zai")) && cfg.Providers.Zhipu.APIKey != "":
|
case (strings.Contains(lowerModel, "glm") || strings.Contains(lowerModel, "zhipu") || strings.Contains(lowerModel, "zai")) && cfg.Providers.Zhipu.APIKey != "":
|
||||||
|
|
@ -452,4 +459,4 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewHTTPProvider(apiKey, apiBase, proxy), nil
|
return NewHTTPProvider(apiKey, apiBase, proxy), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue