Repository navigation
Update instructions to avoid common local LLM errors - #14
Merged
Merged
Conversation
Locally hosted, smaller, LLMs are likely to make two errors when calling tools: using 'kwargs' as a literal argument name, pushing real arguments too deep into the call, and using 'query' for the argument to the 'sql_query' tool, rather than 'sql'. This patch updates the prompt to try to avoid both of these mistakes.
Contributor
Author
|
Addresses #12. |
blech
marked this pull request as ready for review
May 22, 2026 17:22
Contributor
|
The |
Contributor
|
I'm going to land this now, and file a new issue for building a small eval suite to help test the prompt against more models. |
simonw
added a commit
that referenced
this pull request
Nov 1, 2026
The list of databases and tables in the system prompt changed whenever a table was created, invalidating any provider prompt cache for the whole conversation history, and it had no size limit. The prompt is now the same for every actor and schema, and models call list_databases_and_tables. That tool is now the main way to find tables, so it has to cope with large instances. Output over the 10,000 character limit was cut by halving the list of databases, silently dropping whole databases. It now returns every database with a table_count and a note to call the new list_tables tool, which takes a required database argument. If a single database is still too long, list_tables returns as many names as fit and suggests searching sqlite_master. sql_query with display=user hid the rows from the model, so a COUNT(*) came back as row_count 1 and Qwen 3.5 4B could report that as the answer. Single-row results now go to the model as well as the user. Results with more rows include a note saying how to read the values. sql_query with display=both now includes num_rows_shown_to_user when there is more than one row. The model's copy of the rows can be cut to fit the output limit while the user's table is not, so Qwen 3.5 4B was reporting 250 rows when the user could see 1,000. Two sql_query output fields are renamed so that smaller models are less likely to misread them: row_count is now num_rows_shown_to_user, and truncated is now has_more_rows. Saved conversations keep the old names, and nothing reads them back. Other system prompt changes: - Say that the databases are SQLite - Remove the warning about wrapping arguments in a kwargs key, added in #14. That appears to have been caused by llm-ollama showing models a phantom kwargs parameter, which it fixed in 9739550 and c8a6fd6 by honoring input_schema Tested against Qwen 3.5 4B using llm-lmstudio. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Locally hosted, smaller, LLMs are likely to make two errors
when calling tools: using 'kwargs' as a literal argument name,
pushing real arguments too deep into the call, and using 'query'
for the argument to the 'sql_query' tool, rather than 'sql'.
This patch updates the prompt to try to avoid both of these
mistakes.