AI-Studio/app/MindWork AI Studio/Tools/ToolCallingSystem/Harness/IToolCallingLoop.cs
Peer Hogeterp 4d8d30e15e
Added tool calling support (#731)
Co-authored-by: krut_ni <nils.kruthoff@dlr.de>
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
2026-09-04 15:48:07 +02:00

23 lines
1.1 KiB
C#

using AIStudio.Provider;
namespace AIStudio.Tools.ToolCallingSystem.Harness;
/// <summary>
/// Drives a conversation in which a model may call tools before it answers.
/// </summary>
/// <remarks>
/// Resolved through dependency injection so that a different harness can take over later without
/// touching the providers: an agent mode needs more than "ask, execute, ask again", but it speaks
/// to providers through the same adapters.
/// </remarks>
public interface IToolCallingLoop
{
/// <summary>
/// Runs the conversation until the model answers, the limits are reached, or the request fails.
/// </summary>
/// <param name="adapter">The adapter for the provider API in use.</param>
/// <param name="context">The chat, tools, and UI state this run belongs to.</param>
/// <param name="token">The cancellation token.</param>
/// <returns>The model's final answer, with the sources the tools contributed.</returns>
public IAsyncEnumerable<ContentStreamChunk> RunAsync(IToolCallingProviderAdapter adapter, ToolCallingLoopContext context, CancellationToken token = default);
}