🐛 Fix function call bug, for real this time
This commit is contained in:
@@ -141,7 +141,7 @@ public class ThoughtController(ThoughtProvider provider, ThoughtService service)
|
|||||||
break;
|
break;
|
||||||
case ThinkingMessagePartType.FunctionResult:
|
case ThinkingMessagePartType.FunctionResult:
|
||||||
var resultObject = part.FunctionResult!.Result;
|
var resultObject = part.FunctionResult!.Result;
|
||||||
var resultString = resultObject is string s ? s : JsonSerializer.Serialize(resultObject);
|
var resultString = resultObject as string ?? JsonSerializer.Serialize(resultObject);
|
||||||
functionResults.Add(new FunctionResultContent(
|
functionResults.Add(new FunctionResultContent(
|
||||||
callId: part.FunctionResult.CallId,
|
callId: part.FunctionResult.CallId,
|
||||||
functionName: part.FunctionResult.FunctionName,
|
functionName: part.FunctionResult.FunctionName,
|
||||||
|
|||||||
@@ -73,24 +73,21 @@ public class ThoughtProvider
|
|||||||
throw new IndexOutOfRangeException("Unknown thinking provider: " + ModelProviderType);
|
throw new IndexOutOfRangeException("Unknown thinking provider: " + ModelProviderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add gRPC clients for Thought Plugins
|
||||||
|
builder.Services.AddServiceDiscoveryCore();
|
||||||
|
builder.Services.AddServiceDiscovery();
|
||||||
|
builder.Services.AddAccountService();
|
||||||
|
builder.Services.AddSphereService();
|
||||||
|
|
||||||
|
builder.Plugins.AddFromObject(new SnAccountKernelPlugin(_accountClient));
|
||||||
|
builder.Plugins.AddFromObject(new SnPostKernelPlugin(_postClient));
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Experimental("SKEXP0050")]
|
[Experimental("SKEXP0050")]
|
||||||
private void InitializeHelperFunctions()
|
private void InitializeHelperFunctions()
|
||||||
{
|
{
|
||||||
var accountPlugin = new SnAccountKernelPlugin(_accountClient);
|
|
||||||
var postPlugin = new SnPostKernelPlugin(_postClient);
|
|
||||||
|
|
||||||
// Add Solar Network tools plugin
|
|
||||||
Kernel.ImportPluginFromFunctions("solar_network", [
|
|
||||||
KernelFunctionFactory.CreateFromMethod(accountPlugin.GetAccount),
|
|
||||||
KernelFunctionFactory.CreateFromMethod(accountPlugin.GetAccountByName),
|
|
||||||
KernelFunctionFactory.CreateFromMethod(postPlugin.GetPost),
|
|
||||||
KernelFunctionFactory.CreateFromMethod(postPlugin.ListPosts),
|
|
||||||
KernelFunctionFactory.CreateFromMethod(postPlugin.ListPostsWithinTime)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Add web search plugins if configured
|
// Add web search plugins if configured
|
||||||
var bingApiKey = _configuration.GetValue<string>("Thinking:BingApiKey");
|
var bingApiKey = _configuration.GetValue<string>("Thinking:BingApiKey");
|
||||||
if (!string.IsNullOrEmpty(bingApiKey))
|
if (!string.IsNullOrEmpty(bingApiKey))
|
||||||
|
|||||||
Reference in New Issue
Block a user