The Prompt Library supports two prompt structures:
The prompt structure is fixed at creation time. A prompt created with create_prompt (text)
cannot later be turned into a chat prompt, and vice versa — attempting it raises
PromptTemplateStructureMismatch.
A text prompt is a single string template with {{variable}} substitution. They are ideal for
single-turn interactions or when you need to generate a single piece of text.
Each call with new content creates a new version, which is visible in the library:

If you are not using the SDK, you can also fetch a prompt through the REST API.
A chat prompt is a structured list of messages with roles (system, user, assistant), in
the same shape that OpenAI-compatible chat completion APIs accept. They are the right choice
when your agent has a multi-turn message structure.
{{variable}}) or Jinja2 syntaxOnce saved, a chat prompt has its own view in the Prompt Library:

The output of chat_prompt.format() is already in the shape the OpenAI chat completion API
expects:
Chat prompts can capture a multi-turn flow, with assistant turns inline and variables anywhere in the conversation:
Chat prompts can include images and videos alongside text — useful for vision-enabled models.
You can combine multiple content blocks in a single message — e.g. two images with text around them:
When formatting multimodal prompts, you can specify supported_modalities to control how
content is rendered:
{"vision": True}), the structured content is preserved.<<<image>>><<</image>>>).This lets you reuse the same template with different models that may or may not support certain modalities.
Both text and chat prompts support two template engines for variable substitution:
Mustache is simple, portable, and covers the common case of substituting variables into a template.
Jinja2 supports conditionals, loops, and filters, which makes it a better fit when your prompt needs to branch on input values.
Jinja2 is more powerful for branching prompt logic; Mustache is simpler and more portable across other tools that consume the same template. Pick the one that fits your prompt.
To discover prompts by name substring or filter expression, use search_prompts /
searchPrompts. Filters use Opik Query Language (OQL), the same syntax used elsewhere in Opik:
search_prompts returns the latest version for each matching prompt. To explore the full
version history of a single prompt, see Version control.
The filter_string parameter takes one or more <column> <operator> <value> clauses joined
with AND:
Examples:
tags contains "production" — Filter by tagname contains "summary" — Filter by name substringcreated_by = "user@example.com" — Filter by creatortags contains "alpha" AND tags contains "beta" — Multiple tag filtering (AND)template_structure = "text" — Only text promptstemplate_structure = "chat" — Only chat prompts