Interface: TextAdapter<TModel, TProviderOptions, TInputModalities, TMessageMetadataByModality>#
Defined in: activities/chat/adapter.ts:52
Text adapter interface with pre-resolved generics.
An adapter is created by a provider function: provider('model') → adapter
All type resolution happens at the provider call site, not in this interface.
Generic parameters:
- TModel: The specific model name (e.g., 'gpt-4o')
- TProviderOptions: Provider-specific options for this model (already resolved)
- TInputModalities: Supported input modalities for this model (already resolved)
- TMessageMetadata: Metadata types for content parts (already resolved)
Type Parameters#
TModel#
TModel extends string
TProviderOptions#
TProviderOptions extends Record<string, any>
TInputModalities#
TInputModalities extends ReadonlyArray<Modality>
TMessageMetadataByModality#
TMessageMetadataByModality extends DefaultMessageMetadataByModality
Properties#
~types#
~types: object;
Defined in: activities/chat/adapter.ts:68
Internal
Type-only properties for inference. Not assigned at runtime.
inputModalities#
inputModalities: TInputModalities;
messageMetadataByModality#
messageMetadataByModality: TMessageMetadataByModality;
providerOptions#
providerOptions: TProviderOptions;
chatStream()#
chatStream: (options) => AsyncIterable<StreamChunk>;
Defined in: activities/chat/adapter.ts:77
Stream text completions from the model
Parameters#
options#
TextOptions<TProviderOptions>
Returns#
AsyncIterable<StreamChunk>
kind#
readonly kind: "text";
Defined in: activities/chat/adapter.ts:59
Discriminator for adapter kind
model#
readonly model: TModel;
Defined in: activities/chat/adapter.ts:63
The model this adapter is configured for
name#
readonly name: string;
Defined in: activities/chat/adapter.ts:61
Provider name identifier (e.g., 'openai', 'anthropic')
structuredOutput()#
structuredOutput: (options) => Promise<StructuredOutputResult<unknown>>;
Defined in: activities/chat/adapter.ts:89
Generate structured output using the provider's native structured output API. This method uses stream: false and sends the JSON schema to the provider to ensure the response conforms to the expected structure.
Parameters#
options#
StructuredOutputOptions<TProviderOptions>
Structured output options containing chat options and JSON schema
Returns#
Promise<StructuredOutputResult<unknown>>
Promise with the raw data (validation is done in the chat function)