Skip to content

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

NameType
messagesUniversalMessage[]
modelstring
providerstring
contextOptions?ContextOptions
serviceOptions?ConversationServiceOptions

Returns

ConversationContext

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

NameType
providerAIProvider
contextConversationContext
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

NameType
providerAIProvider
contextConversationContext
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

NameType
contextConversationContext

Returns

Object

NameType
isValidboolean
errorsstring[]

Defined in

packages/agents/src/interfaces/service.ts:201

Released under the MIT License.