Conversation
Closed
1 task done
…_format_context_length
1 task
teknium1
added a commit
that referenced
this pull request
Sep 12, 2026
…der is saved without one Leaving the context-length prompt blank in the custom-endpoint wizard said "will auto-detect" and then went silent, so users could not tell whether their endpoint runs on a detected window or the runtime's default fallback (which shapes compression and prompt-cache behaviour). After the save prompt, run the same resolver the runtime uses (with the endpoint's URL and key) and print either "auto-detected N tokens" or "not detected — using the default N tokens". Feedback only: the probe result is not persisted, and a failing probe never blocks the save. Fixes #2513. Approach from PR #2522 (@ygd58) and PR #85499 (@Luna161), both written against the pre-decomposition wizard module. Co-authored-by: Luna161 <268031236+Luna161@users.noreply.github.com>
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.
Fixes #2513
Problem
When saving a custom provider via /model without specifying a context length, users had no feedback on what context window was being used.
Fix
After the user leaves context length blank, attempt auto-detection via
get_model_context_length(model_name):💡 Context length auto-detected: X tokensand save to config📏 Context length: using default 128,000 tokensTests
Added
tests/test_custom_provider_context_detection.pywith 4 tests:_save_custom_providerwith context_length_save_custom_providerwithout context_length