Skip to content

feat: add first-class support for Tencent Hunyuan 3 (hy3) - #4

Merged
jatmn merged 5 commits into
mainfrom
feat/hy3-support
Aug 6, 2026
Merged

feat: add first-class support for Tencent Hunyuan 3 (hy3)#4
jatmn merged 5 commits into
mainfrom
feat/hy3-support

Conversation

@jatmn

@jatmn jatmn commented Jul 12, 2026

Copy link
Copy Markdown
Owner

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/completions API.

Catalog (configs/model-families/hy3.toml)

  • 256K context, text-only modalities, parallel tool calls disabled.
  • Reasoning levels none/low/high (medium dropped; hy3 has no medium mode); default high.
  • Codex custom (apply_patch freeform) tools coerced to functions via as_function and reconstructed on return.
  • Broad family (hy3, priority 0) plus exact entry (hy3_exact, priority 10) covering hy3, hy3:free, hicap/hy3:free, tencent/hy3, tencent/hy3:free.

Runtime translation fixes (so hy3 is fully usable)

  • Reasoning output: chat_reasoning_text now also flattens provider reasoning_details arrays (OpenRouter shape) in addition to reasoning_content/reasoning, so hy3's chain-of-thought surfaces to Codex. (Previously dropped.)
  • Reasoning input: new transform field reasoning_effort_none_value remaps Codex noneno_think (config.rs, transform_morph.rs) so the provider receives a valid reasoning mode.

Docs / tests

  • Updated README.md and docs/model-family-catalogs.md tables and transform-field docs.
  • Added tests for the catalog match/metadata, reasoning_details extraction, and the noneno_think remap.

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 confirm noneno_think behaves as expected on that specific backend.

jatmn added a commit that referenced this pull request Jul 12, 2026
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).
jatmn added 3 commits August 5, 2026 23:42
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).
Rebase onto main and resolve transform/catalog conflicts while keeping
main's disable-effort remap helpers.

- Fall through empty reasoning_content/reasoning to reasoning_details
- Tighten Hunyuan patterns to exact Hy3 aliases; exclude hunyuan-30b/35b
- Enable preserve_reasoning_content_history for multi-turn tool+reasoning
- Drop risky custom_tool_input single-field heuristic; require input key
- Document deny_unknown_fields for model-family overlays; add rejection test
@jatmn
jatmn force-pushed the feat/hy3-support branch from 9fbe991 to 7a61038 Compare August 6, 2026 06:46
@jatmn jatmn self-assigned this Aug 6, 2026
@jatmn jatmn added the enhancement New feature or request label Aug 6, 2026
jatmn added 2 commits August 6, 2026 08:05
Track accumulated reasoning text so streaming deltas work for both
incremental fragments and cumulative provider snapshots. Add
deny_unknown_fields to RequestMorph so morph entry typos fail startup,
and document provider metadata in the unknown-key scope.
Add a Tencent-specific hy3_tencent overlay so disable-effort sends
thinking.type: disabled without an invalid reasoning_effort, drop the
overbroad hunyuan-3b pattern, and tighten MorphSelector validation.
@jatmn
jatmn merged commit 49a6d86 into main Aug 6, 2026
3 checks passed
@jatmn
jatmn deleted the feat/hy3-support branch August 6, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant