Returning output from a native function #5986
-
Hi team, Is there a way to get the output of native function's plugin. In this example below, I'd like to capture I'm using Auto Function Calling but can't find where the output results are stored. I mostly followed the example, with the addition of Auto Function Calling. Would this be a case where a handlebar planner could fulfil the need? [Description("Filter catalog items")]
public class FilterCatalogItem (CatalogClientChatService catalogClientChatService)
{
// need to fix this code to ensure catalogServiceClient exists
[KernelFunction, Description("Return a list of catalog items filtered by name or description")]
public async Task<CatalogItemsPage> GetCatalogItems(
[Description("Name or description of the item to be queried")] string? searchText)
{
if (catalogClientChatService is not null)
{
var items = await catalogClientChatService.SearchItemsAsync(searchText);
return items;
}
else
{
throw new InvalidOperationException("CatalogServiceClient is not available");
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@vicperdana Could you please provide an example where you execute auto function calling? If you are triggering auto function calling with |
Beta Was this translation helpful? Give feedback.
@vicperdana In this case, we do not provide function result, because streaming chunks are returning independently from function calling functionality. So, there are a couple of ways how to get each function result:
Kernel
, you can useIChatCompletionService
(you can get it fromkernel.GetRequiredService<IChatCompletionService>()
) and execute streaming withGetStreamingChatMessageContentsAsync
method. This method acceptsChatHistory
object, and this object will be updated with each function result.