Ell — Prompt Engineering as Code in Python
Treat prompts as versioned Python functions with automatic tracking, visualization, and A/B testing. Like Git for your AI prompts with a beautiful studio UI.
Instalación con revisión previa
Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.
npx -y tokrepo@latest install 603314fc-c123-48c9-b802-1742be2c37bc --target codexPrimero dry-run, confirma las escrituras y luego ejecuta este comando.
What it is
Ell is a Python library that treats prompts as versioned, testable, and trackable code artifacts. Instead of managing prompts as strings in config files or databases, you write them as decorated Python functions. Ell automatically tracks changes, enables A/B testing, and provides a visual studio for exploring prompt versions and their outputs.
The library targets ML engineers, prompt engineers, and developers who need systematic prompt management with version history, performance comparison, and reproducibility.
How it saves time or tokens
Prompt iteration without tracking is chaotic: you lose what worked, cannot compare versions, and cannot reproduce results. Ell solves this by versioning every prompt change automatically. The visual studio shows which prompt versions produced better outputs, enabling data-driven optimization instead of guesswork.
How to use
- Install Ell:
pip install ell-ai. - Decorate your prompt functions with
@ell.simpleor@ell.complex. - Call the function normally and Ell tracks the invocation, version, and output.
Example
import ell
ell.init(store='./ell_store', autocommit=True)
@ell.simple(model='gpt-4o')
def summarize(text: str) -> str:
'''You are a concise summarizer. Summarize the following text in 2 sentences.'''
return text
# Call like a normal function
result = summarize('Long article text here...')
print(result)
# Launch the visual studio to explore versions
# ell-studio --storage ./ell_store
Related on TokRepo
- Prompt Library -- browse and manage reusable prompts
- AI Tools for Coding -- developer tools for AI workflows
Common pitfalls
- Ell stores prompt versions locally by default. For team collaboration, configure a shared storage backend.
- The
@ell.simpledecorator expects the docstring to be the system prompt and the return value to be the user message. Reversing these causes unexpected behavior. - Ell's autocommit tracks every function edit. In rapid iteration, this creates many versions. Use manual commits for cleaner version history.
Preguntas frecuentes
Ell hashes the function source code (including the docstring) on each call. When the code changes, it creates a new version automatically. All versions are stored with their outputs, enabling comparison and rollback.
ell-studio is a web-based visual interface for exploring prompt versions, comparing outputs, and analyzing performance. It reads from the local store and displays version history, token usage, and output quality metrics.
Yes. Ell supports OpenAI, Anthropic, and any OpenAI-compatible API. You specify the model in the decorator and Ell routes the call to the appropriate provider.
Yes. The @ell.complex decorator supports structured outputs, tool calling, and multi-turn conversations. Use @ell.simple for single-turn text generation and @ell.complex for advanced use cases.
Yes. Ell is open source and free to use. The library and ell-studio are both included in the pip package.
Referencias (3)
- Ell GitHub— Prompts as versioned Python functions
- Ell Documentation— Visual studio for prompt exploration
- Ell Versioning Docs— Automatic version tracking and comparison
Relacionados en TokRepo
Fuente y agradecimientos
Created by William Guss. Licensed under MIT.
MadcowD/ell — 6k+ stars
Discusión
Activos relacionados
Awesome Prompt Engineering — Papers, Tools & Courses
Hand-curated collection of 60+ papers, 50+ tools, benchmarks, and courses for prompt engineering and context engineering. Covers CoT, RAG, agents, security, and multimodal. Apache 2.0.
Prompt Engineering Techniques — 20+ Methods
Comprehensive prompt engineering collection with 20+ techniques. 7.3K+ stars. Chain-of-Thought, ReAct, Tree-of-Thought, runnable notebooks.
Prompt Engineering Guide — 73K-Star Learning Hub
The most comprehensive open-source prompt engineering resource with guides, papers, notebooks, and courses covering chain-of-thought, RAG, AI agents, and 13 languages. 3M+ learners, MIT.
prompt_toolkit — Build Powerful Interactive Command Lines in Python
prompt_toolkit is a Python library for building interactive command-line applications with multi-line editing, syntax highlighting, auto-completion, and dialog-based UIs.