# ell

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

- Category: App Orchestration / Prompt Programming
- Language: Python
- Repository: https://github.com/MadcowD/ell
- Website: https://docs.ell.so/
- Canonical page: https://ai-tldr.dev/tools/ell/

## In short

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). It sits in the Prompt Programming category of the App Orchestration tools and is open-source, written in Python.

## 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.

1. Install ell

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

```bash
pip install -U "ell-ai[all]"
```

2. Verify the install

   Check that ell imports and prints a version.

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

3. 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.

```python
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")
```

4. Launch Ell Studio

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

```bash
ell-studio --storage ./logdir
```

## 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
