fix(server): report tool_calling and context_window in /v1/models#105
fix(server): report tool_calling and context_window in /v1/models#105elyasmnvidian wants to merge 1 commit into
Conversation
WalkthroughThe server maps context exhaustion errors to HTTP 400 responses with an OpenAI-compatible error code. Model listings now expose tool-calling support and inferred context-window values, with integration tests covering both changes. ChangesServer behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/switchyard-server/tests/server.rs (1)
217-242: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover
ContextPoolExhaustedseparately.This test exercises only
ContextWindowExceeded, while the production mapping also handlesContextPoolExhausted. Add a profile/test for the second variant so regressions in that branch cannot pass unnoticed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/switchyard-server/tests/server.rs` around lines 217 - 242, Add a separate test alongside context_window_overflow_maps_to_client_error using a profile that triggers ContextPoolExhausted. Send the same chat completion request through build_switchyard_router, then assert the response is BAD_REQUEST with error.code set to the expected client-facing code for pool exhaustion, covering the distinct production mapping branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/switchyard-server/tests/server.rs`:
- Around line 217-242: Add a separate test alongside
context_window_overflow_maps_to_client_error using a profile that triggers
ContextPoolExhausted. Send the same chat completion request through
build_switchyard_router, then assert the response is BAD_REQUEST with error.code
set to the expected client-facing code for pool exhaustion, covering the
distinct production mapping branch.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 4f5c9536-37c6-407c-a66f-fcadc9be076c
📒 Files selected for processing (2)
crates/switchyard-server/src/lib.rscrates/switchyard-server/tests/server.rs
01a361b to
5a75be1
Compare
Live before/after —
|
Signed-off-by: Elyas Mehtabuddin <emehtabuddin@nvidia.com>
5a75be1 to
fe15312
Compare
Reworked onto the post-#98 libsy server — live before/after#98 ("serve libsy algorithms without profiles") merged into Ran the Rust libsy server on
The claude route id infers its real 200k window; an unknown id falls back to the 128k default. |
GET /v1/modelsfrom the Rust libsy server reportedtool_callingandcontext_windowasnullfor every model. This fills them in:tool_calling: true, andcontext_windowinferred from the model id using the same known-model table as the Python listing (deepseek-v4 and nemotron-3-super = 1,000,000; nemotron-3-nano = 262,000; kimi-k2 = 256,000; claude = 200,000; anything else = 128,000).Rebased onto
mainafter #98 ("serve libsy algorithms without profiles") landed. #98 already maps a context-window overflow to HTTP 400context_length_exceeded, so that half of the original PR is dropped — this PR is now just the/v1/modelscapability fields.Test
models_advertise_capabilities_from_the_model_nameasserts a claude route id advertises 200000 and an unknown id the 128000 default, both withtool_calling: true.