Conversation
… in the prompt Introspection now reads col_description() and pg_enum labels for every column; format_schema renders them, so the generator filters on real states instead of guessing them. New generation rules pin down answer shape: exactly the columns asked for, no speculative filters, INNER JOIN by default, status columns over timestamp inference.
When the database rejects a query, feed the SQL plus the database's own error back to the model for a bounded number of corrected attempts. Repaired SQL is re-validated by the sqlglot guard and re-confirmed in the REPL before it runs. Empty results never trigger repair — empty is often the right answer.
v0.3.0: enum-aware prompts, execution-guided self-repair, tighter generation rules
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.
Promotes staging to main for the 0.3.0 release. Code changes were reviewed in #16; this PR adds the measured results that gate the promotion.
Results
Re-ran the same 100-question suite against the same 211-table Postgres schema, same model (gpt-4o), temperature 0, single-state EX@1 — only the package version changed.
Where it came from, by question bucket: single-table questions 58.6 → 82.8, lexical-gap questions 36.4 → 72.7 (that's the enum vocabulary doing its job — the model stops guessing state names), joins 64 → 68. The honest negatives: analytical questions (window functions) stay at 20%, and multi-join dipped 58.3 → 50.0 on a 12-question bucket — both are composition limits the next release should target, not regressions I can explain away.
The cost of the gains: +10% prompt tokens for the enum lists and ~+200 ms/query average from repair rounds on failing queries. Worth it.
Release mechanics after merge: tag
v0.3.0(trusted publishing pushes to PyPI), GitHub release with the changelog notes.