ProviderRegistry
Namespace: Vercel.AI
public sealed class ProviderRegistryLooks 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
Constructors
Section titled “Constructors”ProviderRegistry(string)
Section titled “ProviderRegistry(string)”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 |
Properties
Section titled “Properties”LanguageModelMiddleware
Section titled “LanguageModelMiddleware”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>
Methods
Section titled “Methods”DecisionModel(string)
Section titled “DecisionModel(string)”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
EmbeddingModel(string)
Section titled “EmbeddingModel(string)”public IEmbeddingModel EmbeddingModel(string providerAndModel)Resolves provider:model to an embedding model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: IEmbeddingModel
EvaluationModel(string)
Section titled “EvaluationModel(string)”[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
FileStore(string)
Section titled “FileStore(string)”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
ImageModel(string)
Section titled “ImageModel(string)”public IImageModel ImageModel(string providerAndModel)Resolves provider:model to an image model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: IImageModel
LanguageModel(string)
Section titled “LanguageModel(string)”public ILanguageModel LanguageModel(string providerAndModel)Resolves provider:model to a language model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: ILanguageModel
Register(string, ProviderBase)
Section titled “Register(string, ProviderBase)”public void Register(string id, ProviderBase provider)Registers a provider under <code class=“paramref”>id</code>.
Parameters
| Name | Type | Description |
|---|---|---|
id |
string | |
provider |
ProviderBase |
RerankingModel(string)
Section titled “RerankingModel(string)”public IRerankingModel RerankingModel(string providerAndModel)Resolves provider:model to a reranking model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: IRerankingModel
RubricModel(string)
Section titled “RubricModel(string)”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
SkillStore(string)
Section titled “SkillStore(string)”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
SpeechModel(string)
Section titled “SpeechModel(string)”public ISpeechModel SpeechModel(string providerAndModel)Resolves provider:model to a speech model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: ISpeechModel
TranscriptionModel(string)
Section titled “TranscriptionModel(string)”public ITranscriptionModel TranscriptionModel(string providerAndModel)Resolves provider:model to a transcription model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: ITranscriptionModel
VideoModel(string)
Section titled “VideoModel(string)”public IVideoModel VideoModel(string providerAndModel)Resolves provider:model to a video model.
Parameters
| Name | Type | Description |
|---|---|---|
providerAndModel |
string |
Returns: IVideoModel
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product