<!--
 ⚠️  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) / MessageConverter

# Class: MessageConverter

Universal message converter utility
Handles message format conversion between different providers

## Table of contents

### Constructors

- [constructor](MessageConverter#constructor)

### Methods

- [toProviderFormat](MessageConverter#toproviderformat)
- [extractSystemMessage](MessageConverter#extractsystemmessage)
- [filterNonSystemMessages](MessageConverter#filternonsystemmessages)

## Constructors

### constructor

• **new MessageConverter**(): [`MessageConverter`](MessageConverter)

#### Returns

[`MessageConverter`](MessageConverter)

## Methods

### toProviderFormat

▸ **toProviderFormat**(`messages`, `providerName`): `ProviderMessage`[]

Convert messages to provider-specific format

#### Parameters

| Name           | Type                                                  |
| :------------- | :---------------------------------------------------- |
| `messages`     | [`TUniversalMessage`](../modules#tuniversalmessage)[] |
| `providerName` | `string`                                              |

#### Returns

`ProviderMessage`[]

#### Defined in

[packages/agents/src/utils/message-converter.ts:46](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/utils/message-converter.ts#L46)

---

### extractSystemMessage

▸ **extractSystemMessage**(`messages`): `undefined` \| `string`

Extract system message from messages

#### Parameters

| Name       | Type                                                  |
| :--------- | :---------------------------------------------------- |
| `messages` | [`TUniversalMessage`](../modules#tuniversalmessage)[] |

#### Returns

`undefined` \| `string`

#### Defined in

[packages/agents/src/utils/message-converter.ts:121](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/utils/message-converter.ts#L121)

---

### filterNonSystemMessages

▸ **filterNonSystemMessages**(`messages`): [`TUniversalMessage`](../modules#tuniversalmessage)[]

Filter non-system messages

#### Parameters

| Name       | Type                                                  |
| :--------- | :---------------------------------------------------- |
| `messages` | [`TUniversalMessage`](../modules#tuniversalmessage)[] |

#### Returns

[`TUniversalMessage`](../modules#tuniversalmessage)[]

#### Defined in

[packages/agents/src/utils/message-converter.ts:129](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/utils/message-converter.ts#L129)
