Skip to content

Commit 133e5f2

Browse files
authored
Merge branch 'SciSharp:master' into master
2 parents bda1351 + adc3cd5 commit 133e5f2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Plugins/BotSharp.Plugin.GoogleAI/Providers/Chat/GeminiChatCompletionProvider.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,19 @@ public void SetModelName(string model)
126126
if (!agentService.RenderFunction(agent, function)) continue;
127127

128128
var def = agentService.RenderFunctionProperty(agent, function);
129-
var str = JsonSerializer.Serialize(def.Properties);
129+
var props = JsonSerializer.Serialize(def?.Properties);
130+
var parameters = !string.IsNullOrWhiteSpace(props) && props != "{}" ? new Schema()
131+
{
132+
Type = ParameterType.Object,
133+
Properties = JsonSerializer.Deserialize<dynamic>(props),
134+
Required = def?.Required ?? []
135+
} : null;
130136

131137
funcDeclarations.Add(new FunctionDeclaration
132138
{
133139
Name = function.Name,
134140
Description = function.Description,
135-
Parameters = new()
136-
{
137-
Type = str != "{}" ? ParameterType.Object : ParameterType.TypeUnspecified,
138-
Properties = str != "{}" ? JsonSerializer.Deserialize<dynamic>(str) : null,
139-
Required = def.Required
140-
}
141+
Parameters = parameters
141142
});
142143

143144
funcPrompts.Add($"{function.Name}: {function.Description} {def}");

0 commit comments

Comments
 (0)