Import Template
Various LLM tools allow storing prompts in text or markdown files.
You can use importTemplate
to import these files into a prompt.
Explain your answer step by step.
importTemplate("cot.md");
Variable interpolation
importTemplate
supports mustache variable interpolation. You can use variables in the imported template and pass them as arguments to the importTemplate
function.
The current time is {{time}}.
importTemplate("time.md", { time: "12:00" });
Mustache supports arguments as functions. This allows you to pass dynamic values to the template.
importTemplate("time.md", { time: () => Date.now() });
File globs
You can specify an array of files or glob patterns.
importTemplate("*.prompt")
Other File formats
Aside from the basic text or markdown formats, importTemplate
also supports these variations automatically.
Prompty
Prompty provides a simple markdown-based format for prompts. It adds the concept of role sections to the markdown format.
---name: Basic Promptdescription: A basic prompt that uses the chat API to answer questions...inputs: question: type: stringsample: "question": "Who is the most famous person in the world?"---system:You are an AI assistant who helps people find information.As the assistant, you answer questions briefly, succinctly.
user:{{question}}
importTemplate("basic.prompty", { question: "what is the capital of France?" });