File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/Plugins/BotSharp.Plugin.GoogleAI/Providers/Chat Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -126,18 +126,18 @@ 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 str = JsonSerializer . Serialize ( def ? . Properties ) ;
130130
131131 funcDeclarations . Add ( new FunctionDeclaration
132132 {
133133 Name = function . Name ,
134134 Description = function . Description ,
135- Parameters = new ( )
135+ Parameters = str != "{}" ? new ( )
136136 {
137- Type = str != "{}" ? ParameterType . Object : ParameterType . TypeUnspecified ,
138- Properties = str != "{}" ? JsonSerializer . Deserialize < dynamic > ( str ) : null ,
139- Required = def . Required
140- }
137+ Type = ParameterType . Object ,
138+ Properties = JsonSerializer . Deserialize < dynamic > ( str ) ,
139+ Required = def ? . Required ?? [ ]
140+ } : null
141141 } ) ;
142142
143143 funcPrompts . Add ( $ "{ function . Name } : { function . Description } { def } ") ;
You can’t perform that action at this time.
0 commit comments