Skip to content

TypeSafeAiProvider

Namespace: Vercel.AI.TypeSafeAi

public sealed class TypeSafeAiProvider

TypeSafe’s experimental decision capability. It has no language, embedding, or image models.

Inheritance: object

View source

TypeSafeAiProvider(TypeSafeAiOptions?, HttpClient?)

Section titled “TypeSafeAiProvider(TypeSafeAiOptions?, HttpClient?)”
public TypeSafeAiProvider(TypeSafeAiOptions? options = null, HttpClient? httpClient = null)

Creates a provider.

Parameters

Name Type Description
options TypeSafeAiOptions
httpClient HttpClient

View source

public const string ApiKeyEnvironmentVariable = "TYPESAFE_AI_API_KEY"

Environment variable for the API key.

Value: string

View source

public const string BaseUrlEnvironmentVariable = "TYPESAFE_AI_BASE_URL"

Environment variable for the API base URL.

Value: string

View source

public const string DecisionProviderId = "typesafe.decision"

Provider id of the decision model.

Value: string

View source

public const string DefaultBaseUrl = "https://api.typesafe.ai/v1"

Default API origin.

Value: string

View source

[Obsolete("Use DecisionProviderId instead.")]
public const string EvaluationProviderId = "typesafe.decision"

Deprecated alias of DecisionProviderId.

Value: string

View source

public static TypeSafeAiProvider Default { get; }

Provider that reads TYPESAFE_AI_API_KEY when a request is made. It reads TYPESAFE_AI_BASE_URL when it is first created.

Value: TypeSafeAiProvider

View source

public string SpecificationVersion { get; }

Specification version.

Value: string

View source

Create(TypeSafeAiOptions?, HttpMessageHandler?)

Section titled “Create(TypeSafeAiOptions?, HttpMessageHandler?)”
public static TypeSafeAiProvider Create(TypeSafeAiOptions? options = null, HttpMessageHandler? handler = null)

Creates a provider. Pass a handler from tests.

Parameters

Name Type Description
options TypeSafeAiOptions
handler HttpMessageHandler

Returns: TypeSafeAiProvider

View source

public TypeSafeAiDecisionModel DecisionModel(string modelId)

Returns a decision model. The id may be one this library does not know yet.

Parameters

Name Type Description
modelId string

Returns: TypeSafeAiDecisionModel

View source

public IEmbeddingModel EmbeddingModel(string modelId)

TypeSafe has no embedding models.

Parameters

Name Type Description
modelId string

Returns: IEmbeddingModel

View source

[Obsolete("Use DecisionModel instead.")]
public TypeSafeAiEvaluationModel EvaluationModel(string modelId)

Deprecated alias of DecisionModel(string).

Parameters

Name Type Description
modelId string

Returns: TypeSafeAiEvaluationModel

View source

public IImageModel ImageModel(string modelId)

TypeSafe has no image models.

Parameters

Name Type Description
modelId string

Returns: IImageModel

View source

public ILanguageModel LanguageModel(string modelId)

TypeSafe has no language models.

Parameters

Name Type Description
modelId string

Returns: ILanguageModel

View source

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