Skip to content

DecisionLanguageModel

Namespace: Vercel.AI.Operations

public sealed class DecisionLanguageModel : IEvaluationDecisionCaller, IDecisionCaller, IEvaluationCaller

Adapts structured language-model output to Choice, Score, and Boolean decisions. Maps to DecisionLanguageModel.

Inheritance: object

Implements: IEvaluationDecisionCaller, IDecisionCaller, IEvaluationCaller

View source

DecisionLanguageModel(ILanguageModel, string?)

Section titled “DecisionLanguageModel(ILanguageModel, string?)”
public DecisionLanguageModel(ILanguageModel model, string? provider = null)

Wraps a language model. The provider id defaults to {model.Provider}.decision.

Parameters

Name Type Description
model ILanguageModel
provider string

View source

public string ModelId { get; }

Model id.

Value: string

View source

public string Provider { get; }

Provider id.

Value: string

View source

public string SpecificationVersion { get; }

Specification version. Only v4 is accepted.

Value: string

View source

public IReadOnlyList<string> SupportedQuestionTypes { get; }

Question types this model can answer.

Value: IReadOnlyList<string>

View source

public static DecisionLanguageModel Deserialize(DecisionLanguageModelOptions options)

Restores a model from Serialize(DecisionLanguageModel). Maps to [WORKFLOW_DESERIALIZE].

Parameters

Name Type Description
options DecisionLanguageModelOptions

Returns: DecisionLanguageModel

View source

DoDecideAsync(DecisionModelCall, CancellationToken)

Section titled “DoDecideAsync(DecisionModelCall, CancellationToken)”
public Task<DecisionModelResult> DoDecideAsync(DecisionModelCall call, CancellationToken cancellationToken = default)

Answers every question with one structured-output model call.

Parameters

Name Type Description
call DecisionModelCall
cancellationToken CancellationToken

Returns: Task<DecisionModelResult>

View source

DoEvaluateAsync(EvaluationModelCall, CancellationToken)

Section titled “DoEvaluateAsync(EvaluationModelCall, CancellationToken)”
[Obsolete("Use DoDecideAsync instead.")]
public Task<EvaluationModelResult> DoEvaluateAsync(EvaluationModelCall call, CancellationToken cancellationToken)

Deprecated. Use CancellationToken).

Parameters

Name Type Description
call EvaluationModelCall
cancellationToken CancellationToken

Returns: Task<EvaluationModelResult>

View source

public static DecisionLanguageModelOptions Serialize(DecisionLanguageModel model)

Serializes the wrapped model and the provider id for a workflow boundary. Maps to [WORKFLOW_SERIALIZE].

Parameters

Name Type Description
model DecisionLanguageModel

Returns: DecisionLanguageModelOptions

View source

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