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)
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 = str != "{}" ? new ( )
136- {
137- Type = ParameterType . Object ,
138- Properties = JsonSerializer . Deserialize < dynamic > ( str ) ,
139- Required = def ? . Required ?? [ ]
140- } : null
141+ Parameters = parameters
141142 } ) ;
142143
143144 funcPrompts . Add ( $ "{ function . Name } : { function . Description } { def } ") ;
You can’t perform that action at this time.
0 commit comments