Skip to content

ProviderRegistry

Namespace: Vercel.AI

public sealed class ProviderRegistry

Looks up provider models by provider:model ids. Maps to createProviderRegistry. Everything after the first separator is the model id, so model ids may contain the separator.

Inheritance: object

View source

public ProviderRegistry(string separator = ":")

Creates a registry. <code class=“paramref”>separator</code> splits the provider id from the model id.

Parameters

Name Type Description
separator string

View source

public IReadOnlyList<ILanguageModelMiddleware>? LanguageModelMiddleware { get; set; }

Middleware applied to every language model the registry returns. The first one sees the call first.

Value: IReadOnlyList<ILanguageModelMiddleware>

View source

public IDecisionCaller DecisionModel(string providerAndModel)

Resolves provider:model to a decision model. The provider must implement IDecisionProvider or the deprecated IEvaluationProvider, or NoSuchModelError is thrown.

Parameters

Name Type Description
providerAndModel string

Returns: IDecisionCaller

View source

public IEmbeddingModel EmbeddingModel(string providerAndModel)

Resolves provider:model to an embedding model.

Parameters

Name Type Description
providerAndModel string

Returns: IEmbeddingModel

View source

[Obsolete("Use DecisionModel instead.")]
public IEvaluationDecisionCaller EvaluationModel(string providerAndModel)

Deprecated alias of DecisionModel(string). Returns the same model, which also has the deprecated CancellationToken). Maps to evaluationModel.

Parameters

Name Type Description
providerAndModel string

Returns: IEvaluationDecisionCaller

View source

public IFileStore FileStore(string providerId)

Returns the file store of the provider registered under <code class=“paramref”>providerId</code>.

Parameters

Name Type Description
providerId string

Returns: IFileStore

View source

public IImageModel ImageModel(string providerAndModel)

Resolves provider:model to an image model.

Parameters

Name Type Description
providerAndModel string

Returns: IImageModel

View source

public ILanguageModel LanguageModel(string providerAndModel)

Resolves provider:model to a language model.

Parameters

Name Type Description
providerAndModel string

Returns: ILanguageModel

View source

public void Register(string id, ProviderBase provider)

Registers a provider under <code class=“paramref”>id</code>.

Parameters

Name Type Description
id string
provider ProviderBase

View source

public IRerankingModel RerankingModel(string providerAndModel)

Resolves provider:model to a reranking model.

Parameters

Name Type Description
providerAndModel string

Returns: IRerankingModel

View source

public IRubricModel RubricModel(string providerAndModel)

Resolves provider:model to a model that scores a candidate against a rubric.

Parameters

Name Type Description
providerAndModel string

Returns: IRubricModel

View source

public ISkillStore SkillStore(string providerId)

Returns the skill store of the provider registered under <code class=“paramref”>providerId</code>.

Parameters

Name Type Description
providerId string

Returns: ISkillStore

View source

public ISpeechModel SpeechModel(string providerAndModel)

Resolves provider:model to a speech model.

Parameters

Name Type Description
providerAndModel string

Returns: ISpeechModel

View source

public ITranscriptionModel TranscriptionModel(string providerAndModel)

Resolves provider:model to a transcription model.

Parameters

Name Type Description
providerAndModel string

Returns: ITranscriptionModel

View source

public IVideoModel VideoModel(string providerAndModel)

Resolves provider:model to a video model.

Parameters

Name Type Description
providerAndModel string

Returns: IVideoModel

View source

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