Skip to content

ToolChoiceViolationException

Namespace: Vercel.AI.GenerateText

public sealed class ToolChoiceViolationException : AiSdkException, ISerializable

The model response did not satisfy toolChoice. Maps to ToolChoiceViolationError.

Inheritance: object → Exception → AiSdkException

Implements: ISerializable

View source

ToolChoiceViolationException(string, ToolChoice, FinishReason, string, string, IReadOnlyList<GeneratedContent>)

Section titled “ToolChoiceViolationException(string, ToolChoice, FinishReason, string, string, IReadOnlyList<GeneratedContent>)”
public ToolChoiceViolationException(string message, ToolChoice toolChoice, FinishReason finishReason, string provider, string modelId, IReadOnlyList<GeneratedContent> content)

Creates the exception.

Parameters

Name Type Description
message string
toolChoice ToolChoice
finishReason FinishReason
provider string
modelId string
content IReadOnlyList<GeneratedContent>

View source

public IReadOnlyList<GeneratedContent> Content { get; }

Content from the rejected model call.

Value: IReadOnlyList<GeneratedContent>

View source

public FinishReason FinishReason { get; }

Finish reason from the model call.

Value: FinishReason

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Name { get; }

Stable error name.

Value: string

View source

public string Provider { get; }

Model provider id.

Value: string

View source

public ToolChoice ToolChoice { get; }

Tool choice that was violated.

Value: ToolChoice

View source

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