Skip to content

NoObjectGeneratedException

Namespace: Vercel.AI.GenerateObject

public sealed class NoObjectGeneratedException : AiSdkError, ISerializable, IErrorMarkers

Thrown when a model response cannot produce the requested object. Maps to NoObjectGeneratedError.

Inheritance: object → Exception → AiSdkError

Implements: ISerializable, IErrorMarkers

View source

NoObjectGeneratedException(string, Exception?, string?, StepResponse, LanguageModelUsage, FinishReason)

Section titled “NoObjectGeneratedException(string, Exception?, string?, StepResponse, LanguageModelUsage, FinishReason)”
public NoObjectGeneratedException(string message, Exception? cause, string? text, StepResponse response, LanguageModelUsage usage, FinishReason finishReason)

Creates the exception and preserves the failed generation details.

Parameters

Name Type Description
message string
cause Exception
text string
response StepResponse
usage LanguageModelUsage
finishReason FinishReason

View source

public const string ErrorMarker = "vercel.ai.error.AI_NoObjectGeneratedError"

Marker for IsInstance(object).

Value: string

View source

public FinishReason FinishReason { get; }

Why the model finished generating.

Value: FinishReason

View source

public StepResponse Response { get; }

Response metadata from the model call.

Value: StepResponse

View source

public string? Text { get; }

The selected text that failed to parse or validate.

Value: string

View source

public LanguageModelUsage Usage { get; }

Token usage from the model call.

Value: LanguageModelUsage

View source

public static bool IsInstance(object? error)

Returns whether <code class=“paramref”>error</code> carries this error’s marker.

Parameters

Name Type Description
error object

Returns: bool

View source

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