ExtractionLanguageModel
Namespace: Vercel.AI.Operations
public sealed class ExtractionLanguageModel : IExtractionCallerAdapts structured language-model output to typed field extraction. Maps to ExtractionLanguageModel.
Inheritance: object
Implements: IExtractionCaller
Constructors
Section titled “Constructors”ExtractionLanguageModel(ILanguageModel, string?, double)
Section titled “ExtractionLanguageModel(ILanguageModel, string?, double)”public ExtractionLanguageModel(ILanguageModel model, string? provider = null, double maxFieldsPerCall = Infinity)Wraps a language model. The provider id defaults to {model.Provider}.extraction.
Parameters
| Name | Type | Description |
|---|---|---|
model |
ILanguageModel | The language model. |
provider |
string | The extraction provider id. |
maxFieldsPerCall |
double | Most fields per language-model call, for providers that limit schema size. Larger field maps are split into parallel calls whose answers are merged. Usage is summed, and response and provider metadata come from the first call. A positive integer or PositiveInfinity, the default, which means no limit. |
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.
Value: string
SpecificationVersion
Section titled “SpecificationVersion”public string SpecificationVersion { get; }Specification version. Only v4 is accepted.
Value: string
SupportedFieldTypes
Section titled “SupportedFieldTypes”public IReadOnlyList<string> SupportedFieldTypes { get; }Field types this model can extract. Unsupported types are rejected before any provider I/O.
Value: IReadOnlyList<string>
Methods
Section titled “Methods”Deserialize(ExtractionLanguageModelOptions)
Section titled “Deserialize(ExtractionLanguageModelOptions)”public static ExtractionLanguageModel Deserialize(ExtractionLanguageModelOptions options)Restores a model from Serialize(ExtractionLanguageModel). Maps to [WORKFLOW_DESERIALIZE].
Parameters
| Name | Type | Description |
|---|---|---|
options |
ExtractionLanguageModelOptions |
Returns: ExtractionLanguageModel
DoExtractAsync(ExtractionModelCall, CancellationToken)
Section titled “DoExtractAsync(ExtractionModelCall, CancellationToken)”public Task<ExtractionModelResult> DoExtractAsync(ExtractionModelCall call, CancellationToken cancellationToken = default)Extracts every field with one structured-output model call, or one per group of maxFieldsPerCall fields.
Parameters
| Name | Type | Description |
|---|---|---|
call |
ExtractionModelCall | |
cancellationToken |
CancellationToken |
Returns: Task<ExtractionModelResult>
Serialize(ExtractionLanguageModel)
Section titled “Serialize(ExtractionLanguageModel)”public static ExtractionLanguageModelOptions Serialize(ExtractionLanguageModel model)Serializes the wrapped model, the provider id, and the field limit for a workflow boundary. Maps to [WORKFLOW_SERIALIZE].
Parameters
| Name | Type | Description |
|---|---|---|
model |
ExtractionLanguageModel |
Returns: ExtractionLanguageModelOptions
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product