Inside every AI-powered pipeline, the unreliable part is the same: the LLM call itself. Silent failures, untestable outputs, no guarantees. Mellea is a Python library for writing generative programs — replacing brittle prompts and flaky agents with structured, testable AI workflows built around type-annotated outputs, verifiable requirements, and automatic retries.
InstallSee installation docs for additional options, such as installing all extras via uv pip install 'mellea[all]'.
For source installation directly from this repo, see CONTRIBUTING.md.
The @generative decorator turns a typed Python function into a structured LLM call.
Docstrings become prompts, type hints become schemas — no templates, no parsers:
from pydantic import BaseModel from mellea import generative, start_session class UserProfile(BaseModel): name: str age: int @generative def extract_user(text: str) -> UserProfile: """Extract the user's name and age from the text.""" m = start_session() user = extract_user(m, text="User log 42: Alice is 31 years old.") print(user.name) # Alice print(user.age) # 31 — always an int, guaranteed by the schema
start_session() is the convenience entry point: it returns a MelleaSession
with sensible defaults you can override as needed.
@generative turns typed functions into LLM calls; Pydantic schemas are enforced at generation timemify| Resource | Description |
|---|---|
| docs.mellea.ai | Full docs — vision, tutorials, API reference, how-to guides |
| Colab notebooks | Interactive examples you can run immediately |
| Code examples | Runnable examples: RAG, agents, Instruct-Validate-Repair (IVR), MObjects, and more |
We welcome contributions of all kinds — bug fixes, new backends, standard library components, examples, and docs.
Questions? See GitHub Discussions.
IBM ❤️ Open Source AIMellea was started by IBM Research in Cambridge, MA.
Licensed under the Apache-2.0 License. Copyright © 2026 Mellea.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Write a coding agent from first principles: better tools | 0 | 10 | 12-07-2026 |
| 2 | Gleam for Python Programmers | 0 | 10 | 19-07-2026 |
| 3 | MO-Gymnasium - environments for reinforcement learning | 0 | 26.67 | 19-07-2026 |
| 4 | pyStrich: 1D and 2D Barcode Generator Library | 0 | 10 | 18-07-2026 |
| 5 | userharbor: Framework Agnostic User Management | 0 | 10 | 27-07-2026 |
| 6 | Running Gemma 4 in the Browser with Transformers.js and WebGPU | 0 | 20 | 02-08-2026 |
| 7 | django-orm-lens: Django Schema Review | 0 | 35 | 10-08-2026 |
| 8 | 0 | 5 | 25-05-2026 | |
| 9 | 0 | 0 | 19-04-2026 | |
| 10 | 0 | 0 | 19-04-2026 |