Skip to content

Prompt ($)

The $ is a JavaScript tagged template that expands the string into the final prompt.

example.genai.js
$`You are a helpful assistant.`
👤 user
You are a helpful assistant.

Inline expressions

You can weave expressions in the template using ${...}. Expression can be promises and will be awaited when rendering the final prompt.

example.genai.js
$`Today is ${new Date().toDateString()}.`
👤 user
Today is Thu Jun 13 2024.