# 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. ## Install Paste the prompt below into your AI tool: ## Quick Use ```bash pip install ell-ai ``` ```python import ell @ell.simple(model="claude-sonnet-4-20250514") def summarize(text: str) -> str: "You are a concise summarizer." return f"Summarize this: {text}" result = summarize("Long article text here...") print(result) ``` ## What is Ell? Ell treats prompts as versioned, typed Python functions instead of opaque strings. Every prompt call is automatically tracked with inputs, outputs, and metadata — viewable in Ell Studio, a local visualization tool. It brings software engineering practices (versioning, testing, monitoring) to prompt engineering. **Answer-Ready**: Ell is a Python library that treats AI prompts as versioned functions with automatic tracking, visualization in Ell Studio, and A/B testing. It brings software engineering practices to prompt engineering. 6k+ GitHub stars. **Best for**: Teams iterating on prompts who need versioning and analytics. **Works with**: OpenAI, Anthropic, any OpenAI-compatible API. **Setup time**: Under 2 minutes. ## Core Features ### 1. Prompts as Functions ```python import ell @ell.simple(model="claude-sonnet-4-20250514") def write_poem(topic: str) -> str: "You are a creative poet." return f"Write a short poem about {topic}" # Every call is tracked automatically poem = write_poem("sunset") ``` ### 2. Complex Prompts (Multi-Message) ```python @ell.complex(model="claude-sonnet-4-20250514") def chat(history: list[ell.Message]) -> list[ell.Message]: return [ ell.system("You are a helpful assistant."), *history, ] ``` ### 3. Ell Studio — Visual Dashboard ```bash ell-studio --storage ./ell_logs # Opens http://localhost:8000 ``` Studio shows: - Version history of each prompt function - Input/output pairs for every call - Latency and token usage metrics - Diff view between prompt versions ### 4. Automatic Versioning Ell detects when you change a prompt function and creates a new version: ```python # Version 1 @ell.simple(model="claude-sonnet-4-20250514") def greet(name: str): "You are friendly." return f"Say hi to {name}" # Version 2 (auto-detected) @ell.simple(model="claude-sonnet-4-20250514") def greet(name: str): "You are friendly and enthusiastic." return f"Enthusiastically greet {name}" ``` ### 5. Multimodal Support ```python from PIL import Image @ell.simple(model="gpt-4o") def describe_image(image: Image.Image): return [ ell.system("Describe this image in detail."), ell.user(["What do you see?", image]), ] ``` ## Why Use Ell? | Without Ell | With Ell | |-------------|----------| | Prompts as strings in code | Prompts as typed functions | | Manual copy-paste to track changes | Automatic version control | | No visibility into prompt performance | Studio dashboard with metrics | | Hard to compare prompt variants | Built-in A/B comparison | ## FAQ **Q: How does it compare to LangChain?** A: Ell is focused purely on prompt engineering — versioning, tracking, and iteration. LangChain is a broader framework for chains and agents. **Q: Does it work with Claude?** A: Yes, Anthropic Claude is fully supported. **Q: Where is the data stored?** A: Locally in SQLite (default: `./ell_logs/`). No data sent externally. ## Source & Thanks > Created by [William Guss](https://github.com/MadcowD). Licensed under MIT. > > [MadcowD/ell](https://github.com/MadcowD/ell) — 6k+ stars ## 快速使用 ```bash pip install ell-ai ``` 用 Python 装饰器定义 prompt,自动跟踪版本和调用。 ## 什么是 Ell? Ell 将 AI 提示词视为带版本的 Python 函数。每次调用自动追踪输入输出,可在 Ell Studio 可视化面板中查看。 **一句话总结**:Ell 是 Python 库,将提示词作为版本化函数管理,提供自动追踪、可视化和 A/B 测试,6k+ GitHub stars。 **适合人群**:需要提示词版本管理和分析的团队。**支持**:OpenAI、Anthropic、兼容 API。 ## 核心功能 ### 1. 提示词即函数 用 `@ell.simple` 装饰器定义,自动追踪。 ### 2. Ell Studio 可视化 本地仪表盘查看版本历史、调用记录、性能指标。 ### 3. 自动版本控制 修改提示词函数自动创建新版本。 ### 4. 多模态支持 支持图片、文本混合输入。 ## 常见问题 **Q: 和 LangChain 比较?** A: Ell 专注提示词工程(版本、追踪、迭代),LangChain 是更广的框架。 **Q: 数据存在哪?** A: 本地 SQLite,不发送外部。 ## 来源与致谢 > [MadcowD/ell](https://github.com/MadcowD/ell) — 6k+ stars, MIT --- Source: https://tokrepo.com/en/workflows/603314fc-c123-48c9-b802-1742be2c37bc Author: Script Depot