<!--
 ⚠️  AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 This file is automatically generated by scripts/docs-generator.js
 To make changes, edit the source TypeScript files or update the generator script
-->

[agents](../../) / [Exports](../modules) / IConversationService

# Interface: IConversationService

Interface for conversation service operations
All methods should be stateless and pure functions

## Table of contents

### Methods

- [prepareContext](IConversationService#preparecontext)
- [generateResponse](IConversationService#generateresponse)
- [generateStreamingResponse](IConversationService#generatestreamingresponse)
- [validateContext](IConversationService#validatecontext)

## Methods

### prepareContext

▸ **prepareContext**(`messages`, `model`, `provider`, `contextOptions?`, `serviceOptions?`): [`IConversationContext`](IConversationContext)

Prepare conversation context from messages and configuration
Pure function that transforms inputs to context object

#### Parameters

| Name              | Type                                                         |
| :---------------- | :----------------------------------------------------------- |
| `messages`        | [`TUniversalMessage`](../modules#tuniversalmessage)[]        |
| `model`           | `string`                                                     |
| `provider`        | `string`                                                     |
| `contextOptions?` | [`IContextOptions`](IContextOptions)                         |
| `serviceOptions?` | [`IConversationServiceOptions`](IConversationServiceOptions) |

#### Returns

[`IConversationContext`](IConversationContext)

#### Defined in

[packages/agents/src/interfaces/service.ts:161](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/interfaces/service.ts#L161)

---

### generateResponse

▸ **generateResponse**(`provider`, `context`, `serviceOptions?`): `Promise`\<[`IConversationResponse`](IConversationResponse)\>

Generate a response using the AI provider
Stateless operation that handles the full request-response cycle

#### Parameters

| Name              | Type                                                         |
| :---------------- | :----------------------------------------------------------- |
| `provider`        | [`IAIProvider`](IAIProvider)                                 |
| `context`         | [`IConversationContext`](IConversationContext)               |
| `serviceOptions?` | [`IConversationServiceOptions`](IConversationServiceOptions) |

#### Returns

`Promise`\<[`IConversationResponse`](IConversationResponse)\>

#### Defined in

[packages/agents/src/interfaces/service.ts:173](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/interfaces/service.ts#L173)

---

### generateStreamingResponse

▸ **generateStreamingResponse**(`provider`, `context`, `serviceOptions?`): `AsyncGenerator`\<[`IStreamingChunk`](IStreamingChunk), `void`, `never`\>

Generate streaming response using the AI provider
Stateless streaming operation

#### Parameters

| Name              | Type                                                         |
| :---------------- | :----------------------------------------------------------- |
| `provider`        | [`IAIProvider`](IAIProvider)                                 |
| `context`         | [`IConversationContext`](IConversationContext)               |
| `serviceOptions?` | [`IConversationServiceOptions`](IConversationServiceOptions) |

#### Returns

`AsyncGenerator`\<[`IStreamingChunk`](IStreamingChunk), `void`, `never`\>

#### Defined in

[packages/agents/src/interfaces/service.ts:183](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/interfaces/service.ts#L183)

---

### validateContext

▸ **validateContext**(`context`): `Object`

Validate conversation context
Pure validation function

#### Parameters

| Name      | Type                                           |
| :-------- | :--------------------------------------------- |
| `context` | [`IConversationContext`](IConversationContext) |

#### Returns

`Object`

| Name      | Type       |
| :-------- | :--------- |
| `isValid` | `boolean`  |
| `errors`  | `string`[] |

#### Defined in

[packages/agents/src/interfaces/service.ts:193](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/interfaces/service.ts#L193)
