Merge pull request #832 from iceljc/master

fix gemini function call
This commit is contained in:
iceljc 2025-01-15 15:41:22 -06:00 committed by GitHub
commit 71d05fba41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,18 +126,18 @@ public class GeminiChatCompletionProvider : IChatCompletion
if (!agentService.RenderFunction(agent, function)) continue;
var def = agentService.RenderFunctionProperty(agent, function);
var str = JsonSerializer.Serialize(def.Properties);
var str = JsonSerializer.Serialize(def?.Properties);
funcDeclarations.Add(new FunctionDeclaration
{
Name = function.Name,
Description = function.Description,
Parameters = new()
Parameters = str != "{}" ? new()
{
Type = str != "{}" ? ParameterType.Object : ParameterType.TypeUnspecified,
Properties = str != "{}" ? JsonSerializer.Deserialize<dynamic>(str) : null,
Required = def.Required
}
Type = ParameterType.Object,
Properties = JsonSerializer.Deserialize<dynamic>(str),
Required = def?.Required ?? []
} : null
});
funcPrompts.Add($"{function.Name}: {function.Description} {def}");