Skip to content

PruneToolCallsRule

Namespace: Vercel.AI.GenerateText

public sealed class PruneToolCallsRule

One rule for pruning tool calls, results, errors, and approvals. Maps to an entry of the toolCalls array, { type: 'all' | 'before-last-message' | 'before-last-N-messages', tools }.

Inheritance: object

View source

public int? KeepLastMessagesCount { get; }

Number of trailing messages to keep, or null for none (all).

Value: int?

View source

public IReadOnlyList<string>? Tools { get; }

Names of the tools to prune, or null for every tool.

Value: IReadOnlyList<string>

View source

public static PruneToolCallsRule All(IReadOnlyList<string>? tools = null)

Prunes in all messages. Maps to type: 'all'.

Parameters

Name Type Description
tools IReadOnlyList<string> Names of the tools to prune. Null prunes every tool.

Returns: PruneToolCallsRule

View source

public static PruneToolCallsRule BeforeLastMessage(IReadOnlyList<string>? tools = null)

Prunes before the last message. Maps to type: 'before-last-message'.

Parameters

Name Type Description
tools IReadOnlyList<string> Names of the tools to prune. Null prunes every tool.

Returns: PruneToolCallsRule

View source

BeforeLastMessages(int, IReadOnlyList<string>?)

Section titled “BeforeLastMessages(int, IReadOnlyList<string>?)”
public static PruneToolCallsRule BeforeLastMessages(int count, IReadOnlyList<string>? tools = null)

Prunes before the last <code class=“paramref”>count</code> messages. Maps to type: 'before-last-N-messages'.

Parameters

Name Type Description
count int Number of trailing messages to keep unpruned.
tools IReadOnlyList<string> Names of the tools to prune. Null prunes every tool.

Returns: PruneToolCallsRule

View source

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