Skip to main content

@elizaos/core v1.0.0-beta.51 / composePrompt

Function: composePrompt()

composePrompt(options): string

Function to compose a prompt using a provided template and state. It compiles the template (upgrading double braces to triple braces for non-HTML escaping) and then populates it with values from the state. Additionally, it processes the resulting string with composeRandomUser to replace placeholders like {{nameX}}.

Parameters​

• options

Object containing state and template information.

• options.state

The state object containing values to fill the template.

• options.template: TemplateType

The template string or function to be used for composing the prompt.

Returns​

string

The composed prompt output, with state values and random user names populated.

Defined in​

packages/core/src/utils.ts:151