Resolve bounded o1/o3 mid-name segments to the 200K context window#60
Resolve bounded o1/o3 mid-name segments to the 200K context window#60M3gA-Mind wants to merge 1 commit into
Conversation
Segment-mode context matching only checked the first `/`- and `:`-delimited component's leading token, so an o-series id embedded mid-name (e.g. `ollama/mistral-for-o1-benchmark`) returned None. Scan the whole lowercased id for the pattern and accept any occurrence bounded by non-alphanumeric edges, so mid-name o1/o3 tokens resolve to 200K while substrings like `solo1-7b`, `proto3-chat`, and `octo3thing` stay unmatched.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesModel-ID context patterns
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Upstreams bounded o-series (o1/o3) mid-name segment matching for tinyhumansai/openhuman#4566 (Part 1 of 2; host cutover follows after release + pin bump).
Problem
context_window_for_model_idresolves canonical o1/o3 ids (o1,o1-mini,openai/o1-preview, …) but returnedNonefor a bounded-o1-/-o3-token embedded mid-name (e.g.ollama/mistral-for-o1-benchmark).Segment-mode matching only inspected the leading token of the final/- or:-delimited component, so any o-series token that wasn't at the start of the model name was missed.Change
Segmentmatching now scans the whole lowercased id and accepts any occurrence of the pattern that is delimited by a non-alphanumeric boundary (or the string start/end) on both sides. This mirrors the semantics of the host heuristic being retired (o1_o3_segment_contextin openhuman'smodel_context.rs):ollama/mistral-for-o1-benchmark,vllm/qwen-o3-eval.bench).o1,o1-mini,o3-mini,openai/o1-preview).solo1-7b,proto3-chat,octo3thingstay unmatched.This is only the crate's own generic resolution; hosts keep their tier aliases / cost-catalog arms (out of scope here).
Tests
Extended
o1_o3_context_patterns_require_segment_boundariesinsrc/harness/model/test.rswith the new positive mid-name cases and the negative boundary cases.Commands run locally (all green)
cargo fmt --checkcargo clippy --lib --tests -- -D warningscargo test --lib— 1127 passed, 0 failedFollow-up (Part 2, not in this PR)
The host cutover — deleting
o1_o3_segment_contextfrom openhuman'smodel_context.rsand bumping the tinyagents pin — is blocked until this change is merged, released, and the pin bumped. Tracked under tinyhumansai/openhuman#4566.Summary by CodeRabbit