Repository navigation
Ground ReAct answers in executed rows after submit - #794
Open
DinaLaptii wants to merge 1 commit into
Open
DinaLaptii wants to merge 1 commit into
DinaLaptii wants to merge 1 commit into
Conversation
Rewrite the business answer from the executed result with a non-reasoning model, check it with a narrow deterministic number check (one retry), and fall back to a plain rendering of the rows. Gated by TEXT_TO_SQL_REACT_ANSWER_SYNTHESIS (on by default). Part of #252 Signed-off-by: dlaptii <dlaptii@nvidia.com>
DinaLaptii
requested review from
liavnave,
liofnv,
tomer-levin-nv and
yuvalshkolar
as code owners
December 1, 2026 10:26
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait...
|
DinaLaptii
marked this pull request as draft
December 1, 2026 10:27
DinaLaptii
marked this pull request as ready for review
December 1, 2026 10:27
This branch has not been deployed
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.

Rewrite the business answer from the executed result with a non-reasoning model, check it with a narrow deterministic number check (one retry), and fall back to a plain rendering of the rows. Gated by TEXT_TO_SQL_REACT_ANSWER_SYNTHESIS (on by default).
fixed of #252
The "SQL executed" branch
How it worked before
submission.response or "Here is the result of the query.".submit, before the final SQL ran. So it could contradict the rows, for example "200 orders" in the text when the query returned 3.custom_analyses_usedprovenance was computed by a separate call, later, when writing topath_state.format_and_respondwith that text.How it works now
analyses_usedis computed once, earlier (line 184).synthesize_answeris called on the non-reasoning modelstate["llm"]. It receives the question, the SQL, the actual rows, the assumptions, a flag saying whether the result was cut off, and metadata: tables with column descriptions and the saved analyses that were used. The model does not see the draft.column = valueline per row, at most 10 rows.SQLGenerationModel.response.analyses_usedis stored inpath_stateunchanged.Special cases in synthesis
resultis empty): the draft is kept, or the text says the query was not run. Before, this case could read as "no rows".with_structured_output: the answer is built straight from the rows.TEXT_TO_SQL_REACT_ANSWER_SYNTHESIS=false: the old draft is returned, which fully restores the previous behavior.What did not change
predict, "no answer" and "answer without SQL" paths.sql_response_from_db,numeric_kinds,values_digest,candidatesand thevalid_sqldecision.custom_analyses_used.Cost and limits
ColumnAttributelevel do not reach synthesis. Column descriptions and saved analyses do.Summary by CodeRabbit