AnthropicLanguageModel
Namespace: Vercel.AI.Anthropic
public class AnthropicLanguageModel : ILanguageModelAnthropic Messages language model.
Inheritance: object
Implements: ILanguageModel
Derived: MiniMaxChatLanguageModel
Constructors
Section titled “Constructors”AnthropicLanguageModel(AnthropicProvider, string)
Section titled “AnthropicLanguageModel(AnthropicProvider, string)”public AnthropicLanguageModel(AnthropicProvider provider, string modelId)Creates a model.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
AnthropicProvider | |
modelId |
string |
AnthropicLanguageModel(AnthropicProvider, string, AnthropicModelSettings?)
Section titled “AnthropicLanguageModel(AnthropicProvider, string, AnthropicModelSettings?)”public AnthropicLanguageModel(AnthropicProvider provider, string modelId, AnthropicModelSettings? settings)Creates a model for a Messages-compatible provider that adjusts the adapter with <code class=“paramref”>settings</code>.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
AnthropicProvider | |
modelId |
string | |
settings |
AnthropicModelSettings |
Properties
Section titled “Properties”ModelId
Section titled “ModelId”public string ModelId { get; }Model id.
Value: string
Provider
Section titled “Provider”public string Provider { get; }Provider id, such as openai.
Value: string
SpecificationVersion
Section titled “SpecificationVersion”public string SpecificationVersion { get; }Always V4.
Value: string
SupportedUrls
Section titled “SupportedUrls”public virtual IReadOnlyDictionary<string, string> SupportedUrls { get; }URL patterns the model accepts for images and PDFs.
Value: IReadOnlyDictionary<string, string>
Methods
Section titled “Methods”DoGenerateAsync(LanguageModelCallOptions, CancellationToken)
Section titled “DoGenerateAsync(LanguageModelCallOptions, CancellationToken)”public virtual Task<LanguageModelGenerateResult> DoGenerateAsync(LanguageModelCallOptions options, CancellationToken cancellationToken)Generates a complete result.
Parameters
| Name | Type | Description |
|---|---|---|
options |
LanguageModelCallOptions | |
cancellationToken |
CancellationToken |
Returns: Task<LanguageModelGenerateResult>
DoStreamAsync(LanguageModelCallOptions, CancellationToken)
Section titled “DoStreamAsync(LanguageModelCallOptions, CancellationToken)”public virtual Task<LanguageModelStreamResult> DoStreamAsync(LanguageModelCallOptions options, CancellationToken cancellationToken)Streams partial results. The result carries the stream with the request and response info.
Parameters
| Name | Type | Description |
|---|---|---|
options |
LanguageModelCallOptions | |
cancellationToken |
CancellationToken |
Returns: Task<LanguageModelStreamResult>
PrepareCallOptions(LanguageModelCallOptions, IList<AnthropicWarning>)
Section titled “PrepareCallOptions(LanguageModelCallOptions, IList<AnthropicWarning>)”protected virtual LanguageModelCallOptions PrepareCallOptions(LanguageModelCallOptions options, IList<AnthropicWarning> warnings)Lets a compatible provider rewrite the call options before the request is built. Warnings added to <code class=“paramref”>warnings</code> are reported after the request’s own warnings.
Parameters
| Name | Type | Description |
|---|---|---|
options |
LanguageModelCallOptions | |
warnings |
IList<AnthropicWarning> |
Returns: LanguageModelCallOptions
SupportsUrl(string, string)
Section titled “SupportsUrl(string, string)”public bool SupportsUrl(string mediaType, string url)True when <code class=“paramref”>url</code> is an http or https URL for a supported media type.
Parameters
| Name | Type | Description |
|---|---|---|
mediaType |
string | |
url |
string |
Returns: bool
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product