Skip to content

TypeSafeAiDecisionModel

Namespace: Vercel.AI.TypeSafeAi

public class TypeSafeAiDecisionModel : IEvaluationDecisionCaller, IDecisionCaller, IEvaluationCaller

Answers questions through the TypeSafe /systemone route.

Inheritance: object

Implements: IEvaluationDecisionCaller, IDecisionCaller, IEvaluationCaller

Derived: TypeSafeAiEvaluationModel

View source

TypeSafeAiDecisionModel(string, TypeSafeAiDecisionModelConfig?)

Section titled “TypeSafeAiDecisionModel(string, TypeSafeAiDecisionModelConfig?)”
public TypeSafeAiDecisionModel(string modelId, TypeSafeAiDecisionModelConfig? config = null)

Creates a decision model. <code class=“paramref”>modelId</code> may be a model id this library does not know yet.

Parameters

Name Type Description
modelId string
config TypeSafeAiDecisionModelConfig

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

Deserialize(SerializedModelOptions, HttpClient?)

Section titled “Deserialize(SerializedModelOptions, HttpClient?)”
public static TypeSafeAiDecisionModel Deserialize(SerializedModelOptions options, HttpClient? httpClient = null)

Restores a model from Serialize(). When no headers were serialized, authentication is read from TYPESAFE_AI_API_KEY at call time. The HTTP client is not serialized, so pass one to use a custom handler.

Parameters

Name Type Description
options SerializedModelOptions
httpClient HttpClient

Returns: TypeSafeAiDecisionModel

View source

DoDecideAsync(DecisionModelCall, CancellationToken)

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

Decides every question in one 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 SerializedModelOptions Serialize()

Serializes the model id and the JSON-serializable part of the config for a workflow boundary.

Returns: SerializedModelOptions

View source

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