Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:59
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 extends string
TProviderOptions extends Record<string, any>
TInputModalities extends ReadonlyArray<Modality>
TMessageMetadataByModality extends DefaultMessageMetadataByModality
TToolCapabilities extends ReadonlyArray<string> = ReadonlyArray<string>
TToolCallMetadata = unknown
~types: object;~types: object;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:77
Internal
Type-only properties for inference. Not assigned at runtime.
inputModalities: TInputModalities;inputModalities: TInputModalities;messageMetadataByModality: TMessageMetadataByModality;messageMetadataByModality: TMessageMetadataByModality;providerOptions: TProviderOptions;providerOptions: TProviderOptions;toolCallMetadata: TToolCallMetadata;toolCallMetadata: TToolCallMetadata;toolCapabilities: TToolCapabilities;toolCapabilities: TToolCapabilities;chatStream: (options) => AsyncIterable<AGUIEvent>;chatStream: (options) => AsyncIterable<AGUIEvent>;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:88
Stream text completions from the model
TextOptions<TProviderOptions>
AsyncIterable<AGUIEvent>
readonly kind: "text";readonly kind: "text";Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:68
Discriminator for adapter kind
readonly model: TModel;readonly model: TModel;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:72
The model this adapter is configured for
readonly name: string;readonly name: string;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:70
Provider name identifier (e.g., 'openai', 'anthropic')
structuredOutput: (options) => Promise<StructuredOutputResult<unknown>>;structuredOutput: (options) => Promise<StructuredOutputResult<unknown>>;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:100
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.
StructuredOutputOptions<TProviderOptions>
Structured output options containing chat options and JSON schema
Promise<StructuredOutputResult<unknown>>
Promise with the raw data (validation is done in the chat function)
optional structuredOutputStream: (options) => AsyncIterable<AGUIEvent>;optional structuredOutputStream: (options) => AsyncIterable<AGUIEvent>;Defined in: packages/typescript/ai/src/activities/chat/adapter.ts:117
Stream structured output using the provider's native streaming structured output API (stream + response_format json_schema in a single request).
Optional — adapters without native streaming JSON omit this method and the activity layer synthesizes a stream around the non-streaming structuredOutput call.
Implementations must emit standard AG-UI lifecycle events (RUN_STARTED, TEXT_MESSAGE_*, RUN_FINISHED) carrying raw JSON text deltas, plus a final CUSTOM event named structured-output.complete whose value is { object, raw, reasoning? }.
StructuredOutputOptions<TProviderOptions>
AsyncIterable<AGUIEvent>