Table of Contents

Class DefaultToolInvoker

Namespace
OllamaSharp.Tools
Assembly
OllamaSharp.dll

The default tool invoker that supports sync and async tools

public class DefaultToolInvoker : IToolInvoker
Inheritance
DefaultToolInvoker
Implements
Inherited Members

Methods

InvokeAsync(ToolCall, IEnumerable<object>, CancellationToken)

Invokes a collection of tools by AI model tool calls asynchronously.

public Task<ToolResult> InvokeAsync(Message.ToolCall toolCall, IEnumerable<object> tools, CancellationToken cancellationToken)

Parameters

toolCall Message.ToolCall

The of tool call the AI model chose to be invoked.

tools IEnumerable<object>

The collection of tools to be used for invocation.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<ToolResult>

An asynchronous stream of results from the tool invocations.