IP Library Granted Patent US 12705235
Granted Patent B2
US 12705235 · App. 19/039,656 · Granted Aug 11, 2026

Agentic approach to multilingual text-to-SQL conversion with intent detection and self-correction

Inventors: Spandan Mishra (Oakland, CA); Danielle Hyunwon Sim (Los Angeles, CA); Nandan Gautam Thor (Redwood City, CA); Katherine Chiang Lam (New York, NY); Jarod Matthew Hillerman (Huntington Beach, CA); Alan Wayne Gilchrest (Zephyr Cove, NV); Alexander Michael Margaris (Dublin, CA); Taylor Yoojin Lee (San Francisco, CA); Stefan Schlotter (San Francisco, CA)
Assignee: Palo Alto Networks, Inc.
G06F16/24522G06F8/35G06F16/2455
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12705235
App. No.
19/039,656
Granted
Aug 11, 2026
Kind
B2
Abstract

An intent associated with a user input is determined. An augmented prompt for generating a Standard Query Language (SQL) code snippet is generated. An SQL code snippet is generated by using the augmented prompt on a machine learning (ML) model. Results are generated by executing the SQL code snippet on a data lake.

Claims (107)

1 . A method, comprising:

detecting an intent associated with a user input, comprising:

generating intent detection prompt;

using the intent detection prompt on a large language model (LLM);

embedding user input; and

retrieving related question/query examples using the embedded user input on an embedding model;

generating an augmented prompt for generating a Standard Query Language (SQL) code snippet, comprising:

generating an initial augmented prompt based on output of the detecting of the intent; and

performing one or more of the following:

A) modifying the initial augmented prompt to generate the augmented prompt, comprising:

including one or more schema in the initial augmented prompt to generate the augmented prompt; and/or

B) modifying the initial augmented prompt to generate the augmented prompt, comprising:

excluding at least one schema in the initial augmented prompt to generate the augmented prompt;

generating the SQL code snippet by using the augmented prompt on a machine learning (ML) model; and

generating a result by executing the SQL code snippet on a data lake.

2 . The method of claim 1 , further comprising receiving the user input.

3 . The method of claim 1 , wherein one or more ML models include one or more Large Language Models (LLMs).

4 . The method of claim 1 , further comprising generating and enhancing one or more machine generated prompts for use on one or more ML models.

5 . The method of claim 1 , wherein detecting the intent associated with the user input further comprises:

generating an intent detection prompt; and

using the intent detection prompt on another ML model.

6 . The method of claim 1 , further comprising:

receiving results by executing the SQL code snippet on the data lake;

detecting errors in the results of executing the SQL code snippet on the data lake;

in response to a determination that there is an SQL error present in the results:

generating an error correction prompt;

generating a corrected SQL code snippet by using the error correction prompt on another ML model; and

generating corrected results by executing the corrected SQL code snippet on the data lake.

7 . The method of claim 1 , further comprising:

determining whether it is appropriate to visualize results; and

in response to a determination that it is appropriate to visualize the results:

generating a graph generation prompt; and

generating a visualization by using the graph generation prompt on another ML model.

8 . The method of claim 1 , further comprising:

determining whether it is appropriate to analyze results;

in response to a determination that it is appropriate to analyze the results:

determining whether an appropriate tool has been identified; and

in response to a determination that the appropriate tool has been identified:

generating an analytics prompt;

using the analytics prompt on another ML model; and

in response to a determination that requirements are met, generating analysis by executing the appropriate tool on the results with the given requirements.

9 . The method of claim 1 , further comprising:

soliciting feedback of a user; and

in response to a determination that the user provides feedback regarding returned outputs:

generating a regeneration prompt;

generating a regenerated SQL code snippet by using the regeneration prompt on the ML model; and

regenerating results by executing the regenerated SQL code snippet on the data lake.

10 . The method of claim 1 , further comprising determining an optimal result by:

generating a plurality of augmented prompts for generating SQL code snippets;

generating a plurality of SQL code snippets by using each of the plurality of augmented prompts using two or more ML models;

generating a plurality of results by executing the plurality of SQL code snippets on the data lake; and

determining the optimal result by comparing the plurality of results.

11 . The method of claim 10 , further comprising returning an output associated with the optimal result.

12 . The method of claim 10 , wherein determining the optimal result by comparing the plurality of results further comprises determining a result with a highest consensus amongst an ensemble of experts.

13 . A system, comprising:

a processor configured to:

detect an intent associated with a user input, comprising to:

generate intent detection prompt;

use the intent detection prompt on a large language model (LLM):

embed user input; and

retrieve related question/query examples using the embedded user input on an embedding model;

generate an augmented prompt for generating a Standard Query Language (SQL) code snippet, comprising to:

generate an initial augmented prompt based on output of the detecting of the intent; and

perform one or more of the following:

A) modify the initial augmented prompt to generate the augmented prompt, comprising to:

include one or more schema in the initial augmented prompt to generate the augmented prompt; and/or

B) modify the initial augmented prompt to generate the augmented prompt, comprising to:

exclude at least one schema in the initial augmented prompt to generate the augmented prompt;

generate the SQL code snippet by using the augmented prompt on a machine learning (ML) model; and

generate a result by executing the SQL code snippet on a data lake,

a memory coupled to the processor and configured to provide the processor with instructions.

14 . The system of claim 13 , wherein the processor is further configured to receive the user input.

15 . The system of claim 13 , wherein one or more ML models include one or more Large Language Models (LLMs).

16 . The system of claim 13 , wherein the processor is further configured to:

generate an intent detection prompt; and

use the intent detection prompt on another ML model.

17 . The system of claim 13 , wherein the processor is further configured to:

receive results by executing the SQL code snippet on the data lake;

detect errors in the results of executing the SQL code snippet on the data lake; and

in response to a determination that there is an SQL error present in the results:

generate an error correction prompt;

generate a corrected SQL code snippet by using the error correction prompt on the ML model; and generate corrected results by executing the corrected SQL code snippet on the data lake.

18 . The system of claim 13 , wherein the processor is further configured to:

determine whether it is appropriate to visualize results; and

in response to a determination that it is appropriate to visualize the results:

generate a graph generation prompt; and

generate a visualization by using the graph generation prompt on an ML model.

19 . The system of claim 13 , wherein the processor is further configured to:

generate a plurality of augmented prompts for generating SQL code snippets;

generate a plurality of SQL code snippets by using each of the plurality of augmented prompts using two or more ML models;

generate a plurality of results by executing the plurality of SQL code snippets on the data lake; and

determine the optimal result by comparing the plurality of results.

20 . A computer program product embodied in a non-transitory computer readable medium and comprising computer instructions for:

detecting an intent associated with a user input, comprising:

generating intent detection prompt;

using the intent detection prompt on a large language model (LLM);

embedding user input; and

retrieving related question/query examples using the embedded user input on an embedding model;

generating an augmented prompt for generating a Standard Query Language (SQL) code snippet, comprising:

generating an initial augmented prompt based on output of the detecting of the intent; and

performing one or more of the following:

A) modifying the initial augmented prompt to generate the augmented prompt, comprising:

including one or more schema in the initial augmented prompt to generate the augmented prompt; and/or

B) modifying the initial augmented prompt to generate the augmented prompt, comprising:

excluding at least one schema in the initial augmented prompt to generate the augmented prompt;

generating the SQL code snippet by using the augmented prompt on a machine learning (ML) model; and

generating a result by executing the SQL code snippet on a data lake.