feat: add first-class support for Tencent Hunyuan 3 (hy3)#4
Open
jatmn wants to merge 2 commits into
Open
Conversation
Add a model-family catalog for hy3 (Tencent Hunyuan 3), a 295B MoE model with hybrid thinking and native function calling served over the OpenAI-compatible /chat/completions API. Catalog (configs/model-families/hy3.toml): - 256K context, text-only modalities, parallel tool calls disabled. - Reasoning levels none/low/high (medium dropped); default high. - Codex custom (apply_patch) tools coerced to functions via as_function. Runtime translation fixes so hy3 is fully usable: - Surface hybrid thinking to Codex by flattening provider reasoning_details arrays in chat_reasoning_text (response_codec.rs), in addition to reasoning_content/reasoning. - Add transform field reasoning_effort_none_value and remap Codex none -> no_think (config.rs, transform_morph.rs) so the provider receives a valid reasoning mode. Docs/README updated; tests added for the catalog, reasoning_details extraction, and the none-value remap. Validation: cargo fmt --check && cargo test --locked && cargo build --locked && git diff --check
Address review findings from PR #4: - Tighten the over-broad `hunyuan*3*` pattern to `hunyuan3*` so unrelated Hunyuan models (e.g. hunyuan-13b) no longer inherit hy3's transform (none->no_think remap and custom->function coercion). - Add `hicap/hy3` to the README and docs model-family tables. - Document that `medium` is advertised as unsupported (Codex selects from none/low/high) and is forwarded unchanged if a client sends it. - Make `chat_reasoning_text` handle a non-array `reasoning_details` (string or object) and extract `text`/`summary`/`reasoning` keys instead of silently dropping reasoning. - Harden `custom_tool_input` reconstruction: unwrap JSON-encoded strings and fall back to a single string field rather than forwarding the whole JSON object as an invalid apply_patch payload. - Add `#[serde(default, deny_unknown_fields)]` to catalog structs so typos fail config loading instead of being silently ignored. - Add tests for pattern over-match, exact-id transform inheritance, and reasoning/tool-input reconstruction. Validated with `cargo fmt --check && cargo test --locked && cargo build --locked && git diff --check` (136 tests pass).
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.
Summary
Add first-class support for hy3 (Tencent Hunyuan 3) — a 295B MoE model (21B active, 256K context) with hybrid thinking and native function calling, served over the OpenAI-compatible
/chat/completionsAPI.Catalog (
configs/model-families/hy3.toml)none/low/high(medium dropped; hy3 has no medium mode); defaulthigh.custom(apply_patch freeform) tools coerced to functions viaas_functionand reconstructed on return.hy3, priority 0) plus exact entry (hy3_exact, priority 10) coveringhy3,hy3:free,hicap/hy3:free,tencent/hy3,tencent/hy3:free.Runtime translation fixes (so hy3 is fully usable)
chat_reasoning_textnow also flattens providerreasoning_detailsarrays (OpenRouter shape) in addition toreasoning_content/reasoning, so hy3's chain-of-thought surfaces to Codex. (Previously dropped.)reasoning_effort_none_valueremaps Codexnone→no_think(config.rs,transform_morph.rs) so the provider receives a valid reasoning mode.Docs / tests
README.mdanddocs/model-family-catalogs.mdtables and transform-field docs.reasoning_detailsextraction, and thenone→no_thinkremap.Validation
cargo fmt --check && cargo test --locked && cargo build --locked && git diff --check— all 130 tests pass.Follow-up
A live smoke test (per
docs/live-testing.md) against the actual hy3 gateway is recommended to confirmnone→no_thinkbehaves as expected on that specific backend.