Skip to content
Discussion options

You must be logged in to vote

Here is the solution:
var chat = new Chat(ollamaApiClient, systemPrompt);
var searchCollectoddtionTool = new SearchCollectionTool();
var tools = new List
{
new SearchCollectionTool()
};

// callback for tool execution - this is where you can monitor which tools are being called and push updates to the frontend
chat.OnToolCall += async (sender, toolCall) =>
{
// This is your monitoring point
Log.Information($"Executing: {toolCall.Function.Name}");

// Optional: Push a status update to your React frontend
await context.Response.WriteAsync($"event: status\ndata: Using tool {toolCall.Function.Name}...\n\n");
await context.Response.Body.FlushAsync();

};

// 3. Stream the response directly to the…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gordon-vart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant