ConversationHistory class

A section that renders the conversation history.

Extends

Constructors

ConversationHistory(string, number, boolean, string, string, string)

Creates a new 'ConversationHistory' instance.

Properties

assistantPrefix
userPrefix
variable

Inherited Properties

required

If true the section is mandatory otherwise it can be safely dropped.

separator
textPrefix
tokens

The requested token budget for this section.

  • Values between 0.0 and 1.0 represent a percentage of the total budget and the section will be layed out proportionally to all other sections.
  • Values greater than 1.0 represent the max number of tokens the section should be allowed to consume.

Inherited Methods

getMessageText(Message<string>)

Returns the content of a message as a string.

Constructor Details

ConversationHistory(string, number, boolean, string, string, string)

Creates a new 'ConversationHistory' instance.

new ConversationHistory(variable: string, tokens?: number, required?: boolean, userPrefix?: string, assistantPrefix?: string, separator?: string)

Parameters

variable

string

Name of memory variable used to store the histories Message[].

tokens

number

Optional. Sizing strategy for this section. Defaults to proportional with a value of 1.0.

required

boolean

Optional. Indicates if this section is required. Defaults to false.

userPrefix

string

Optional. Prefix to use for user messages when rendering as text. Defaults to user: .

assistantPrefix

string

Optional. Prefix to use for assistant messages when rendering as text. Defaults to assistant: .

separator

string

Optional. Separator to use between messages when rendering as text. Defaults to \n.

Property Details

assistantPrefix

assistantPrefix: string

Property Value

string

userPrefix

userPrefix: string

Property Value

string

variable

variable: string

Property Value

string

Inherited Property Details

required

If true the section is mandatory otherwise it can be safely dropped.

required: boolean

Property Value

boolean

Inherited From PromptSectionBase.required

separator

separator: string

Property Value

string

Inherited From PromptSectionBase.separator

textPrefix

textPrefix: string

Property Value

string

Inherited From PromptSectionBase.textPrefix

tokens

The requested token budget for this section.

  • Values between 0.0 and 1.0 represent a percentage of the total budget and the section will be layed out proportionally to all other sections.
  • Values greater than 1.0 represent the max number of tokens the section should be allowed to consume.
tokens: number

Property Value

number

Inherited From PromptSectionBase.tokens

Inherited Method Details

getMessageText(Message<string>)

Returns the content of a message as a string.

static function getMessageText(message: Message<string>): string

Parameters

message

Message<string>

Message to get the text of.

Returns

string

The message content as a string.

Inherited From PromptSectionBase.getMessageText