Skip to content

LanguageModelTool

Namespace: Vercel.AI.Provider

public sealed class LanguageModelTool

A function tool definition sent to the model.

Inheritance: object

View source

LanguageModelTool(string, string?, JsonElement, bool?)

Section titled “LanguageModelTool(string, string?, JsonElement, bool?)”
public LanguageModelTool(string name, string? description, JsonElement inputSchema, bool? strict = null)

Creates a function tool.

Parameters

Name Type Description
name string
description string
inputSchema JsonElement
strict bool?

View source

public JsonElement Args { get; }

Arguments of a provider-defined tool. Undefined for a function tool.

Value: JsonElement

View source

public string? Description { get; }

Tool description.

Value: string

View source

public JsonElement InputSchema { get; }

JSON Schema for the arguments.

Value: JsonElement

View source

public bool IsProviderDefined { get; }

Whether this is a provider-defined tool rather than a function tool.

Value: bool

View source

public string Name { get; }

Tool name.

Value: string

View source

public JsonElement? OutputSchema { get; init; }

JSON Schema for the tool result. OpenAI Responses parses the result as JSON, so text results of this tool are sent as JSON string literals.

Value: JsonElement?

View source

public JsonElement? ProviderOptions { get; init; }

Provider options of the tool, keyed by provider name, such as { "openai": { "omitFromRequestTools": true } }. Maps to the tool’s providerOptions.

Value: JsonElement?

View source

public string? ProviderToolId { get; }

Provider-defined tool id, or null for a function tool.

Value: string

View source

public bool? Strict { get; }

Responses strict mode. Null means unset, which Responses sends as false.

Value: bool?

View source

ProviderDefined(string, string, JsonElement)

Section titled “ProviderDefined(string, string, JsonElement)”
public static LanguageModelTool ProviderDefined(string id, string name, JsonElement args)

Creates a provider-defined tool. Maps to { type: 'provider', id, name, args }. <code class=“paramref”>id</code> is <provider>.<tool>. <code class=“paramref”>args</code> must be a JSON object.

Parameters

Name Type Description
id string
name string
args JsonElement

Returns: LanguageModelTool

View source

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