Skip to content

EvaluateError

Defined in: packages/ai/src/activities/evaluate/adapter.ts:171

Thrown by an evaluate adapter when the provider answered, but the call cannot become a result. It carries what the provider already returned, so callers can still read the billed usage and the answers that came back.

The name is always EvaluateError. Another package can read this shape without an import of this class. Use isEvaluateError to narrow a caught value. instanceof fails when the app has more than one copy of @tanstack/ai.

Extends

  • Error

Constructors

Constructor

ts
new EvaluateError(init): EvaluateError;

Defined in: packages/ai/src/activities/evaluate/adapter.ts:185

Parameters

init

EvaluateErrorInit

Returns

EvaluateError

Overrides

ts
Error.constructor

Properties

answers?

ts
readonly optional answers?: Record<string, WireAnswer>;

Defined in: packages/ai/src/activities/evaluate/adapter.ts:183

Wire answers the provider did return, before decide() maps them. A choice() answer has choice, and a boolean() answer is { type: 'noul', noul }. A refused question has no key.


code

ts
readonly code: string;

Defined in: packages/ai/src/activities/evaluate/adapter.ts:173

Stable code to branch on, for example EVALUATE_REFUSAL_CODE.


model?

ts
readonly optional model?: string;

Defined in: packages/ai/src/activities/evaluate/adapter.ts:177

Resolved model id from the provider.


usage?

ts
readonly optional usage?: TokenUsage<ProviderUsageDetails>;

Defined in: packages/ai/src/activities/evaluate/adapter.ts:175

Tokens the provider reported for this call.