Skip to content

anthropic / Exports / AnthropicConversationAdapter

Class: AnthropicConversationAdapter

Anthropic ConversationHistory adapter

Converts UniversalMessage to Anthropic prompt format

Table of contents

Constructors

Methods

Constructors

constructor

new AnthropicConversationAdapter(): AnthropicConversationAdapter

Returns

AnthropicConversationAdapter

Methods

toAnthropicPrompt

toAnthropicPrompt(messages, systemPrompt?): string

Convert UniversalMessage array to Anthropic prompt format

Parameters

NameType
messagesUniversalMessage[]
systemPrompt?string

Returns

string

Defined in

adapter.ts:12


extractSystemPrompt

extractSystemPrompt(messages, fallbackSystemPrompt?): undefined | string

Extract system messages and combine them as system prompt

Parameters

NameType
messagesUniversalMessage[]
fallbackSystemPrompt?string

Returns

undefined | string

Defined in

adapter.ts:55


convertMessage

convertMessage(msg): Object

Helper for message conversion testing (converts each message individually)

Parameters

NameType
msgUniversalMessage

Returns

Object

NameType
rolestring
contentstring

Defined in

adapter.ts:68

Released under the MIT License.