Skip to content

ToolSearchGeneration

Namespace: Vercel.AI.Operations

public static class ToolSearchGeneration

Runs the tool-search step loop used by generateText, streamText, and the tool-loop agent. The model tool list, execution timing, and catalog messages match across those modes.

Inheritance: object

View source

RunAsync(string, IReadOnlyDictionary<string, SearchableTool>, IReadOnlyDictionary<string, IReadOnlyList<string>>?, string, IReadOnlyList<IReadOnlyList<ToolSearchCall>>, string, CancellationToken)

Section titled “RunAsync(string, IReadOnlyDictionary<string, SearchableTool>, IReadOnlyDictionary<string, IReadOnlyList<string>>?, string, IReadOnlyList<IReadOnlyList<ToolSearchCall>>, string, CancellationToken)”
public static Task<ToolSearchRun> RunAsync(string mode, IReadOnlyDictionary<string, SearchableTool> tools, IReadOnlyDictionary<string, IReadOnlyList<string>>? routing, string prompt, IReadOnlyList<IReadOnlyList<ToolSearchCall>> calls, string finalText, CancellationToken cancellationToken = default)

Runs one generation mode. Discovered tools appear on the next step.

Parameters

Name Type Description
mode string
tools IReadOnlyDictionary<string, SearchableTool>
routing IReadOnlyDictionary<string, IReadOnlyList<string>>
prompt string
calls IReadOnlyList<IReadOnlyList<ToolSearchCall>>
finalText string
cancellationToken CancellationToken

Returns: Task<ToolSearchRun>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product