harmony  by openai

Renderer for OpenAI's harmony response format

Created 2 months ago
3,895 stars

Top 12.4% on SourcePulse

GitHubView on GitHub
Project Summary

This repository provides the openai-harmony library, a Rust-backed tool for formatting and parsing conversations for OpenAI's open-weight models (gpt-oss). It ensures consistent, loss-free token sequences for structured outputs, tool calling, and multi-channel reasoning, primarily targeting developers building custom inference solutions for these models.

How It Works

The core logic resides in Rust, leveraging tiktoken for tokenization and pyo3 for Python bindings. This approach ensures high performance for rendering and parsing conversation structures, mimicking the OpenAI Responses API. The library supports multiple channels (e.g., analysis, commentary, final) and structured tool calls within a unified format.

Quick Start & Requirements

  • Installation: pip install openai-harmony
  • Prerequisites: Python ≥ 3.8. Rust toolchain recommended for development.
  • Documentation: gpt-oss, harmony format guide

Highlighted Details

  • Implements a consistent, loss-free response format for gpt-oss models.
  • Heavy lifting performed in Rust for performance.
  • First-class Python support with typed stubs and 100% test parity.
  • Supports structured tool calling and multi-channel reasoning.

Maintenance & Community

The project is maintained by OpenAI. Development is primarily in Rust with Python bindings.

Licensing & Compatibility

The repository does not explicitly state a license in the provided README snippet. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The README implies that gpt-oss models must be used with the Harmony format to function correctly. No specific limitations or known issues are detailed.

Health Check
Last Commit

2 months ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
5
Star History
134 stars in the last 30 days

Explore Similar Projects

Starred by Peter Norvig Peter Norvig(Author of "Artificial Intelligence: A Modern Approach"; Research Director at Google).

python-openai-demos by pamelafox

0.7%
405
Python scripts for OpenAI API demos
Created 1 year ago
Updated 2 days ago
Feedback? Help us improve.