fix: make Ask output token budget configurable - #1247
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Thanks for this. The change itself is sound, and I'm parking it deliberately rather than for quality reasons: we're consolidating how max_tokens (and the other model tunables) get configured under #947, with #830 moving them into Settings instead of one environment variable per workflow. I'd rather not add another env var now and deprecate it a release later. I'll revisit this PR once #830 lands; if it ends up being the natural place for this knob, we'll fold it in with credit. |
|
Closing now that #1323 landed on |
Description
Make the Ask/Q&A output token budget configurable across the strategy, intermediate-answer, and final-answer model-generation stages so reasoning models have sufficient budget before thinking content is removed.
Structured strategy generation, intermediate answers, and final answers all use
OPEN_NOTEBOOK_ASK_MAX_TOKENS.The default is
8192tokens.Malformed, zero, and negative values safely fall back to
8192with a warning.Added focused regression tests and configuration documentation.
No API, frontend, provider, dependency, or database behavior changed.
Related Issue
Fixes #1221
Type of Change
How Has This Been Tested?
uv run pytest)Test Details:
uv sync- completed successfully.uv run pytest tests/test_ask_token_budget.py -v- 9 passed, 1 dependency deprecation warning.uv run pytest tests/ -q- 612 passed, 3 failed, 49 errors, 2 dependency warnings. The same three Windows path/proxy-environment failures and 49 temp-directory/Windows-permission errors documented for this PR remain; no Ask-related tests failed.uv run ruff check .- passed.uv run ruff format --check open_notebook/graphs/ask.py tests/test_ask_token_budget.py- 2 files already formatted.uv run python -m mypy .- no issues found in 131 source files.git diff --check- passed.Design Alignment
Which design principles does this PR support? (See VISION.md)
Explanation:
The change adds one narrow, process-level configuration helper instead of expanding the request/API contract. It preserves provider-agnostic model selection and passes the budget through the existing per-call Esperanto configuration path.
Checklist
Code Quality
Testing
make rufforruff check . --fixmake lintoruv run python -m mypy .Documentation
/docs(if applicable)Database Changes
Breaking Changes
Screenshots (if applicable)
Not applicable; this is a backend-only change.
Additional Context
All three Ask model-generation stages use the same cached
OPEN_NOTEBOOK_ASK_MAX_TOKENSvalue: structured strategy generation, fan-out intermediate answers, and final-answer synthesis. The existing structured JSON response format and model-selection behavior remain unchanged.Pre-Submission Verification
Before submitting, please verify:
bferanmi806-sketchfix: make Ask output token budget configurableThank you for contributing to Open Notebook!