refine gemini function parameter
This commit is contained in:
parent
48eb6e8fda
commit
90c2bd75df
|
|
@ -126,18 +126,19 @@ public class GeminiChatCompletionProvider : IChatCompletion
|
|||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
||||
var def = agentService.RenderFunctionProperty(agent, function);
|
||||
var str = JsonSerializer.Serialize(def?.Properties);
|
||||
var props = JsonSerializer.Serialize(def?.Properties);
|
||||
var parameters = !string.IsNullOrWhiteSpace(props) && props != "{}" ? new Schema()
|
||||
{
|
||||
Type = ParameterType.Object,
|
||||
Properties = JsonSerializer.Deserialize<dynamic>(props),
|
||||
Required = def?.Required ?? []
|
||||
} : null;
|
||||
|
||||
funcDeclarations.Add(new FunctionDeclaration
|
||||
{
|
||||
Name = function.Name,
|
||||
Description = function.Description,
|
||||
Parameters = str != "{}" ? new()
|
||||
{
|
||||
Type = ParameterType.Object,
|
||||
Properties = JsonSerializer.Deserialize<dynamic>(str),
|
||||
Required = def?.Required ?? []
|
||||
} : null
|
||||
Parameters = parameters
|
||||
});
|
||||
|
||||
funcPrompts.Add($"{function.Name}: {function.Description} {def}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue