Interface: AIProvider
Provider-agnostic AI Provider interface This interface uses only UniversalMessage types and avoids provider-specific types
Table of contents
Properties
Methods
Properties
name
• Readonly name: string
Provider identifier
Defined in
packages/agents/src/interfaces/provider.ts:168
version
• Readonly version: string
Provider version
Defined in
packages/agents/src/interfaces/provider.ts:170
Methods
chat
▸ chat(messages, options?): Promise<UniversalMessage>
Generate response from AI model using UniversalMessage
Parameters
| Name | Type | Description |
|---|---|---|
messages | UniversalMessage[] | Array of UniversalMessage from conversation history |
options? | ChatOptions | Chat options including tools, model settings, etc. |
Returns
Promise<UniversalMessage>
Promise resolving to a UniversalMessage response
Defined in
packages/agents/src/interfaces/provider.ts:178
chatStream
▸ chatStream(messages, options?): AsyncIterable<UniversalMessage, any, any>
Generate streaming response from AI model using UniversalMessage
Parameters
| Name | Type | Description |
|---|---|---|
messages | UniversalMessage[] | Array of UniversalMessage from conversation history |
options? | ChatOptions | Chat options including tools, model settings, etc. |
Returns
AsyncIterable<UniversalMessage, any, any>
AsyncIterable of UniversalMessage chunks
Defined in
packages/agents/src/interfaces/provider.ts:186
generateResponse
▸ generateResponse(payload): Promise<RawProviderResponse>
Generate response from AI model (raw provider response)
Parameters
| Name | Type | Description |
|---|---|---|
payload | ProviderRequest | Provider request payload |
Returns
Promise<RawProviderResponse>
Promise resolving to raw provider response
Defined in
packages/agents/src/interfaces/provider.ts:193
generateStreamingResponse
▸ generateStreamingResponse(payload): AsyncIterable<RawProviderResponse, any, any>
Generate streaming response from AI model (raw provider response)
Parameters
| Name | Type | Description |
|---|---|---|
payload | ProviderRequest | Provider request payload |
Returns
AsyncIterable<RawProviderResponse, any, any>
AsyncIterable of raw provider response chunks
Defined in
packages/agents/src/interfaces/provider.ts:200
supportsTools
▸ supportsTools(): boolean
Check if the provider supports tool calling
Returns
boolean
true if tool calling is supported
Defined in
packages/agents/src/interfaces/provider.ts:206
validateConfig
▸ validateConfig(): boolean
Validate provider configuration
Returns
boolean
true if configuration is valid
Defined in
packages/agents/src/interfaces/provider.ts:212
dispose
▸ dispose(): Promise<void>
Clean up resources when provider is no longer needed
Returns
Promise<void>
Defined in
packages/agents/src/interfaces/provider.ts:217
close
▸ close(): Promise<void>
Close provider connections and cleanup resources
Returns
Promise<void>