Skip to content

google / Exports / GoogleConversationAdapter

Class: GoogleConversationAdapter

Google AI ConversationHistory adapter

Converts UniversalMessage to Google Generative AI format

Table of contents

Constructors

Methods

Constructors

constructor

new GoogleConversationAdapter(): GoogleConversationAdapter

Returns

GoogleConversationAdapter

Methods

toGoogleFormat

toGoogleFormat(messages): any[]

Convert UniversalMessage array to Google AI message format

Parameters

NameType
messagesUniversalMessage[]

Returns

any[]

Defined in

adapter.ts:12


convertMessage

convertMessage(msg): any

Convert a single UniversalMessage to Google AI format

Parameters

NameType
msgUniversalMessage

Returns

any

Defined in

adapter.ts:21


extractSystemInstruction

extractSystemInstruction(messages, fallbackSystemPrompt?): undefined | string

Extract system messages and combine them as system instruction

Parameters

NameType
messagesUniversalMessage[]
fallbackSystemPrompt?string

Returns

undefined | string

Defined in

adapter.ts:83


processMessages

processMessages(messages, systemPrompt?): Object

Complete message conversion pipeline

Parameters

NameType
messagesUniversalMessage[]
systemPrompt?string

Returns

Object

NameType
contentsany[]
systemInstruction?string

Defined in

adapter.ts:96

Released under the MIT License.