Add Harmony format parsers for GPT-OSS models#50
Merged
waybarrios merged 1 commit intomainfrom Feb 10, 2026
Merged
Conversation
59ca7d2 to
49bbcd1
Compare
|
Update with the latest code: |
This was referenced Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements support for GPT-OSS models that use the Harmony response format (closes #38).
Harmony is a multi-channel format with control tokens that separates reasoning, tool calls, and user-facing responses into distinct channels:
Example of a tool call in Harmony format:
What was added:
HarmonyToolParser (registered as "harmony" and "gpt-oss") that extracts tool calls from commentary channel blocks and final content from the final channel. Supports both non-streaming and streaming modes.
HarmonyReasoningParser (registered as "harmony") that extracts reasoning from analysis channel blocks. Multiple analysis blocks are concatenated. Streaming tracks channel transitions and emits reasoning vs content deltas accordingly.
convert_tools_to_typescript() utility that converts OpenAI JSON Schema tool definitions to the TypeScript namespace format expected by Harmony models:
41 tests covering tool parsing, reasoning parsing, TypeScript conversion, edge cases (unicode, malformed JSON, incomplete calls, mixed channels), and streaming behavior.
CI updated to include the new tests in the test-matrix job.
New files:
Modified files:
Usage:
Test plan: