aminghadersohi opened a new pull request, #39003: URL: https://github.com/apache/superset/pull/39003
### SUMMARY When `execute_sql` responses exceed the token limit, the error message now provides more actionable suggestions: 1. **SQL LIMIT clause** — suggests adding `LIMIT` to the query 2. **Tool `limit` parameter** — suggests using the execute_sql `limit` parameter to cap rows (only when not already specified) 3. **General reduction suggestion** — when no `limit` parameter is set, the general "add a limit" suggestion now fires for execute_sql (previously only fired for `list_*` tools) **Before:** The error only showed a generic SQL LIMIT suggestion. The tool's own `limit` parameter was never mentioned, and the general "add a limit" suggestion was skipped entirely for execute_sql. **After:** ``` Response too large: ~33,348 tokens (limit: 25,000) This response would overwhelm the LLM context window. Please modify your query to reduce the response size: 1. Use the 'limit' parameter (e.g., limit=100) to cap the number of rows returned — need ~25% reduction 2. Add a LIMIT clause to your SQL query (e.g., SELECT * FROM table LIMIT 100) 3. Use the execute_sql 'limit' parameter to cap rows returned (e.g., limit=100) — this overrides any SQL LIMIT clause ``` ### TESTING - Added `test_execute_sql_with_limit_param_no_duplicate_suggestion` test - Updated `test_tool_specific_suggestions_execute_sql` to verify both SQL LIMIT and parameter suggestions - All 33 tests in `test_token_utils.py` pass ### BEFORE/AFTER SCREENSHOTS OR COVERAGE URL N/A — backend-only change, no UI impact. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
