AI/TLDR

ell

Write LLM prompts as versioned Python functions, then track and visualize them

Overview

ell is a Python framework for prompt engineering that treats prompts as programs rather than plain strings. You write a function that returns the text sent to a language model, and ell turns it into what it calls a language model program (LMP). The function's docstring becomes the system message and its return value becomes the user message.

It is aimed at developers who iterate on prompts often and want to treat that work more like code than ad-hoc editing. ell records each version of your prompts to a local store, with auto-generated commit messages, so you can compare changes and catch regressions over time.

As a prompt-programming tool, ell sits between your application code and the model API. It adds versioning, multimodal inputs, and a local web tool called Ell Studio for monitoring and visualizing how your prompts change.

What it does

  • Define prompts as plain Python functions using the @ell.simple decorator, where the docstring is the system message and the return value is the user message
  • Automatic versioning and serialization of prompts to a local store, with auto-generated commit messages
  • Ell Studio, a local open-source tool for prompt version control, monitoring, and visualization
  • First-class multimodal support: pass PIL images and other media inline in Message objects via ell.system and ell.user
  • Rich type coercion for multimodal inputs and outputs, so working with images is similar to working with text

Getting started

Install the package, write your first language model program, and optionally launch Ell Studio to inspect prompt versions.

Install ell

Install ell and Ell Studio from PyPI with the [all] extra.

bashbash
pip install -U "ell-ai[all]"

Verify the install

Check that ell imports and prints a version.

bashbash
python -c "import ell; print(ell.__version__)"

Write a language model program

Decorate a function with @ell.simple. The docstring is the system message and the return value is the user message.

pythonpython
import ell

@ell.simple(model="gpt-4o")
def hello(world : str):
    """You are a helpful assistant that writes in lower case.""" # System Message
    return f"Say hello to {world[::-1]} with a poem."    # User Message

hello("sama")

Launch Ell Studio

Start the local studio against a storage directory to view and monitor your prompt versions.

bashbash
ell-studio --storage ./logdir

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Iterating on a prompt repeatedly and wanting a version history so you can compare changes and roll back regressions
  • Building multimodal prompts that mix text and images, such as describing the contents of a captured photo
  • Treating prompt engineering like a code workflow, with prompts defined as functions checked into your Python project
  • Monitoring and visualizing how prompts evolve over time using a local tool instead of editing strings in place

How ell compares

ell alongside other open-source prompt programming tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
DSPy★ 35.8kA Stanford framework for programming language models with composable modules and automatic prompt optimization instead of hand-written prompts.
ell★ 5.9kWrite LLM prompts as versioned Python functions, then track and visualize them
GEPA★ 5.5kA reflective, evolutionary optimizer that improves prompts and other text components of a system using language-model feedback.
LMQL★ 4.2kA query language for LLMs that mixes Python control flow with prompts and constraints to script multi-step generation.
AdalFlow★ 4.2kA PyTorch-like library for building and auto-optimizing LLM pipelines, tuning prompts across the components of a task.
TextGrad★ 3.6kA library that optimizes prompts and other text variables using textual gradients, applying a backpropagation-like loop driven by LLM feedback.
Mirascope★ 1.5kA lightweight Python toolkit for writing LLM calls as typed functions with prompt templates, chaining, and a single interface across providers.