cohere-melody
Templating rendering and generation parsing for Cohere models
What it is and what it does
Cohere Melody is a Rust library with Python bindings that parses and renders templates for Cohere language models. It handles two main tasks: parsing model outputs to extract citations and structured content (including vision generation markdown with embedded visual elements), and rendering conversation templates into formatted prompts. The library is designed to work with Cohere's Command and other models, supporting streaming text with incremental parsing and batch vision parsing. It has no runtime dependencies beyond the compiled Rust core.
The package is intended for developers integrating Cohere models into applications where citation tracking, prompt templating, and structured output parsing are required. It exposes a Python API built on PyO3 and also provides Go bindings, making it usable across multiple languages. Installation requires no external system dependencies beyond Python itself, though the wheels are pre-compiled for specific platforms.
Use it for:
- Extract and track citations from Cohere model outputs during streaming or batch inference.
- Render multi-turn conversation histories into properly formatted prompts for Cohere Command models.
- Parse vision model outputs to separate markdown text from embedded visual element metadata.
- Build LLM applications that need structured prompt templating and citation attribution.
- Integrate Cohere models into production systems requiring standardized output parsing.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses and renders templated text for Cohere language models, handling citations, vision generation markup, and prompt formatting across Python and Rust.
Yes, if you are building with Cohere models and need reliable citation parsing or prompt templating. The package is actively maintained, has no security vulnerabilities, carries a permissive MIT license, and offers pre-built wheels for common platforms. Install friction is moderate but acceptable for a compiled library. Not necessary if you are not using Cohere models or do not require structured parsing of their outputs.
Install
cohere-melody on PyPI
pip
pip install cohere-melodyuv
uv add cohere-melodypoetry
poetry add cohere-melodyInstalling cohere-melody
Before you install
Medium install friction due to compiled Rust bindings; wheels are pre-built for common platforms (Python 3.10–3.11, Linux, macOS, Windows). Active maintenance with recent release.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
Quickstart
pip install cohere-melody
import cohere_melody
# Parse vision generation
parsed = cohere_melody.parse_vision_generation(model_output)
for segment in parsed.segments:
if hasattr(segment, 'text'):
print(segment.text)
Requires Python 3.10 or later. Pre-built wheels available for Linux (x86_64, aarch64, armv7l, ppc64le, s390x, i686), macOS (x86_64, arm64), Windows (x86_64), and musl-based systems; other platforms may require building from source.
Verify before relying
- Whether the package works with Python versions beyond 3.10–3.11 despite the requires_python constraint.
- Performance characteristics when parsing large or streaming generations.
- Stability and API surface of the Python bindings relative to the Rust core.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 243,717/month — #8,780 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cohere_melody-0.13.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cohere_melody-0.13.3-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; cohere_melody-0.13.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; cohere_melody-0.13.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; cohere_melody-0.13.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cohere_melody-0.13.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; cohere_melody-0.13.3-cp310-cp310-musllinux_1_2_aarch64.whl; cohere_melody-0.13.3-cp310-cp310-musllinux_1_2_armv7l.whl; cohere_melody-0.13.3-cp310-cp310-musllinux_1_2_i686.whl; cohere_melody-0.13.3-cp310-cp310-musllinux_1_2_x86_64.whl; cohere_melody-0.13.3-cp310-cp310-win_amd64.whl; cohere_melody-0.13.3-cp311-cp311-macosx_10_12_x86_64.whl; cohere_melody-0.13.3-cp311-cp311-macosx_11_0_arm64.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cohere_melody-0.13.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl; cohere_melody-0.13.3-cp311-cp311-musllinux_1_2_aarch64.whl
Keywords: cohere, llm, templating, parsing
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
outlines-coreOutlines-core provides structured text…
permissive · top 5,000 on PyPI
renderersConverts chat messages to token IDs for LLM…
permissive · top 15,000 on PyPI
moviepilot-rustProvides Rust-accelerated parsing and filtering…
unclear · top 15,000 on PyPI
langchain-cohereConnects LangChain applications to Cohere's…
permissive · top 5,000 on PyPI
pomlPOML is a markup language and Python SDK for…
unclear · top 15,000 on PyPI
comrakRenders CommonMark and GitHub Flavored Markdown…
permissive · top 15,000 on PyPI
citeproc-pyciteproc-py processes Citation Style Language…
permissive · top 15,000 on PyPI
coherePython SDK for accessing Cohere's language…
permissive · top 1,000 on PyPI
openai-harmonyRenders and parses the Harmony response format…
unclear · top 5,000 on PyPI
cohere-compass-sdkParse documents via a remote Compass Parser API…
unclear · top 15,000 on PyPI