Prompts / Instructions
Prompts generally tell the LLM what to do next. For instance, asking the user for specific information such as their name, insurance number, address/contact details, etc.
Prompts can either be static or dynamic.
Static/Plain Text Prompts
Example:
Greet the caller and ask for their name.In static prompts, you can access all variables from the state using {{variableName}}.
Example: The following information is stored in state:
{
companyName: "claiverly GmbH"
}Prompt that uses this information:
Greet the caller with the following sentence: "Welcome to {{companyName}}".Dynamic/Programmatic Prompts
Sometimes it is necessary to include dynamic information in the prompt that comes from an external source or from state and is not static.
Example: Your application needs the current date and time. LLMs are trained up to a certain point in time and are text-based, so they do not know the current date and time. If the application relies on time information, e.g. for scheduling appointments, the LLM can be informed about the current date and time.
Example of how to provide the current date and time to the LLM:
function prompt(params) {
return ({ "prompt": "Today is " + new Date().toLocaleString() });
}Example of how to include the current temperature at Berlin Alexanderplatz via a webhook query in the prompt:
function prompt(params) {
const temperature = webhook("https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=temperature_2m", {}, {method: "get"});
return ({ "prompt": `The temperature in Berlin is right now: ${JSON.stringify(temperature)}`});
}