Skip to content

Prompts

Cristiano Carvalho edited this page Apr 2, 2026 · 6 revisions

Templates with variable interpolation executed across multiple LLM providers.

Structure

  • name - String identifier
  • description - Purpose
  • template - Text with {{variables}}
  • tags - Array of strings (optional)
  • project_id - Foreign key (optional)

Creating Prompts

Aludel.Prompts.create_prompt(%{
  name: "Code Reviewer",
  template: "Review this {{language}} code:\n\n{{code}}",
  tags: ["code-review", "security"]
})

Variable Syntax

{{variable_name}} - Alphanumeric and underscores only, case-sensitive.

Valid: {{article}}, {{user_input}}, {{item1}} Invalid: {{user input}}, {{user-input}}

Variables extracted automatically:

Aludel.Prompts.extract_variables("Translate {{text}} to {{language}}")
# => ["text", "language"]

Provide variable values as map:

%{"text" => "Hello", "language" => "Spanish"}
# Result: "Translate Hello to Spanish"

Versioning

Edits create immutable versions automatically. Each update_prompt/2 creates new PromptVersion row.

Version comparison available in Evolution tab:

  • Success rate by version
  • Latency/cost trends
  • Test suite performance

Tags and Projects

# Tags
tags: ["summarization", "articles"]
Aludel.Prompts.list_prompts_by_tag("summarization")

# Projects (grouping)
{:ok, project} = Aludel.Prompts.create_project(%{name: "Marketing"})
Aludel.Prompts.create_prompt(%{project_id: project.id, ...})

API Reference

# CRUD
create_prompt(attrs)
update_prompt(prompt, attrs)  # Creates new version
delete_prompt(prompt)
get_prompt!(id)
list_prompts()

# Versioning
list_versions(prompt)
get_version!(id)
revert_to_version(prompt, version_id)

# Variables
extract_variables(template)

Clone this wiki locally