agents / Exports / ConversationServiceInterface
Interface: ConversationServiceInterface
Interface for conversation service operations All methods should be stateless and pure functions
Table of contents
Methods
Methods
prepareContext
▸ prepareContext(messages, model, provider, contextOptions?, serviceOptions?): ConversationContext
Prepare conversation context from messages and configuration Pure function that transforms inputs to context object
Parameters
| Name | Type |
|---|---|
messages | UniversalMessage[] |
model | string |
provider | string |
contextOptions? | ContextOptions |
serviceOptions? | ConversationServiceOptions |
Returns
Defined in
packages/agents/src/interfaces/service.ts:169
generateResponse
▸ generateResponse(provider, context, serviceOptions?): Promise<ConversationResponse>
Generate a response using the AI provider Stateless operation that handles the full request-response cycle
Parameters
| Name | Type |
|---|---|
provider | AIProvider |
context | ConversationContext |
serviceOptions? | ConversationServiceOptions |
Returns
Promise<ConversationResponse>
Defined in
packages/agents/src/interfaces/service.ts:181
generateStreamingResponse
▸ generateStreamingResponse(provider, context, serviceOptions?): AsyncGenerator<StreamingChunk, void, never>
Generate streaming response using the AI provider Stateless streaming operation
Parameters
| Name | Type |
|---|---|
provider | AIProvider |
context | ConversationContext |
serviceOptions? | ConversationServiceOptions |
Returns
AsyncGenerator<StreamingChunk, void, never>
Defined in
packages/agents/src/interfaces/service.ts:191
validateContext
▸ validateContext(context): Object
Validate conversation context Pure validation function
Parameters
| Name | Type |
|---|---|
context | ConversationContext |
Returns
Object
| Name | Type |
|---|---|
isValid | boolean |
errors | string[] |