File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
src/Plugins/BotSharp.Plugin.GoogleAI/Providers/Chat Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -126,18 +126,19 @@ public void SetModelName(string model)
126
126
if ( ! agentService . RenderFunction ( agent , function ) ) continue ;
127
127
128
128
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 ;
130
136
131
137
funcDeclarations . Add ( new FunctionDeclaration
132
138
{
133
139
Name = function . Name ,
134
140
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
141
142
} ) ;
142
143
143
144
funcPrompts . Add ( $ "{ function . Name } : { function . Description } { def } ") ;
You can’t perform that action at this time.
0 commit comments