IP Library Granted Patent US 12,650,979
Granted Patent B2
US 12,650,979 · App. 18/745,835 · Granted Jun 9, 2026

Method for information processing based on LLM, electronic device, and storage medium

Inventors: Haocheng Liu (Beijing, CN); Haiyang Xu (Beijing, CN); Liangjie Zhang (Beijing, CN); Qian Sun (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
G06F16/242G06F16/212G06F16/248
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 12,650,979
App. No.
18/745,835
Granted
Jun 9, 2026
Kind
B2
Abstract

A computer-implemented for information processing based on a large language model (LLM) includes: obtaining a query request; determining, by the LLM and based on the query request, a query condition, a source of a query result, and a select field for generating a structured query language (SQL) statement; generating by the LLM, the SQL statement by combining the query condition, the source of the query result, and the select field; and obtaining the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution.

Claims (80)

1 . A computer-implemented method for information processing based on a large language model (LLM), the method comprising:

obtaining a query request from a user;

generating first prompt information based on the query request, and obtaining identification information of a query object as a query condition by inputting the first prompt information into the LLM;

generating second prompt information based on the query request and description information of a service table in a database, and obtaining a candidate service table as a source of a query result by inputting the second prompt information into the LLM;

extracting a create schema statement of the candidate service table and generating third prompt information based on the create schema statement and the query request, and obtaining a select field by inputting the third prompt information into the LLM, wherein the create schema statement is a statement for creating a new table;

generating, by the LLM, a structured query language (SQL) statement by combining the query condition, the source of the query result, and the select field; and

obtaining the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution;

wherein generating second prompt information based on the query request and the description information of the service table in the database comprises:

generating table reference information based on the description information of the service table, and generating a first target cue word by writing the query request into a first preset cue word; and

generating the second prompt information by splicing the table reference information and the first target cue word.

2 . The method according to claim 1 , wherein before generating second prompt information based on the query request and the description information of the service table in the database, the method further comprises:

obtaining configuration information of the database and determining the description information of the service table based on the configuration information.

3 . The method according to claim 1 , wherein generating the SQL statement, by combining the query condition, the source of the query result, and the select field based on the LLM comprises:

obtaining hierarchical information of a field in the candidate service table and a field default value of the field, and generating a SQL statement reference example of a different hierarchical level based on the hierarchical information, the field default value, and the source of the query result; and

generating fourth prompt information based on the SQL statement reference example, the hierarchical information, the query request and the select field, and obtaining the SQL statement by inputting the fourth prompt information into the LLM.

4 . The method according to claim 3 , wherein generating the SQL statement reference example for the different hierarchical level based on the hierarchical information, the field default value, and the source of the query result comprises:

obtaining a preset candidate query request and determining a target hierarchical level of a query object for the candidate query request; and

determining a query condition example and a select field example for the candidate query request based on the hierarchical information and the field default value; and

generating a SQL statement reference example for the target hierarchical level based on the query condition example, the select field example, and the source of the query result.

5 . The method according to claim 4 , wherein generating the fourth prompt information based on the SQL statement reference example, the hierarchical information, the query request and the select field comprises:

taking the hierarchical information and the SQL statement reference example as first information; and

generating second information based on the query request and the select field; and

obtaining a current query time as third information; and

obtaining hierarchical information of the query object for the query request as fourth information; and

generating a second target cue word by writing the query request into a second preset cue word; and

obtaining the fourth prompt information by splicing the first information, the second information, the third information, the fourth information, and the second target cue word.

6 . The method according to claim 3 , wherein obtaining the SQL statement by inputting the fourth prompt information into the LLM comprises:

performing a syntax check on an initial SQL statement output by the LLM; and

in response to determining a syntax error exists, inputting an error log into the LLM and performing a syntax correction of the initial SQL statement based on the error log until a final SQL statement is obtained.

7 . The method according to claim 1 , wherein obtaining the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution comprises:

obtaining a query result in a java script object notation (JSON) format by performing a format conversion on the query result; and

obtaining a display cue word of the query result, and generating fifth prompt information based on the display cue word and the query result in the JSON format, and obtaining a view display result of the query result by inputting the fifth prompt information into the LLM.

8 . The method according to claim 1 , wherein obtaining the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution comprises:

obtaining a query result in a java script object notation (JSON) format by performing a format conversion on the query result; and

generating sixth prompt information based on the create schema statement and the query result in the JSON format, and obtaining a data report of the query result by inputting the sixth prompt information into the LLM.

9 . An electronic device, comprising:

at least one processor; and

a memory communicatively coupled to the at least one processor and storing instructions executable by the at least one processor;

wherein the at least one processor is configured to:

obtain a query request from a user; and

generate first prompt information based on the query request, and obtain identification information of a query object as a query condition by inputting the first prompt information into a large language model (LLM);

generate second prompt information based on the query request and description information of a service table in a database, and obtain a candidate service table as a source of a query result by inputting the second prompt information into the LLM;

extract a create schema statement of the candidate service table and generating third prompt information based on the create schema statement and the query request, and obtain a select field by inputting the third prompt information into the LLM, wherein the create schema statement is a statement for creating a new table;

generate, by the LLM, a structured query language (SQL) statement by combining the query condition, the source of the query result, and the select field; and

obtain the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution;

wherein the at least one processor is further configured to:

generate table reference information based on the description information of the service table, and generate a first target cue word by writing the query request into a first preset cue word; and

generate the second prompt information by splicing the table reference information and the first target cue word.

10 . The electronic device according to claim 9 , wherein before generating second prompt information based on the query request and the description information of the service table in the database, the at least one processor is further configured to:

obtain configuration information of the database and determine the description information of the service table based on the configuration information.

11 . The electronic device according to claim 9 , wherein the at least one processor is further configured to:

obtain hierarchical information of a field in the candidate service table and a field default value of the field, and generate a SQL statement reference example of a different hierarchical level based on the hierarchical information, the field default value, and the source of the query result; and

generate fourth prompt information based on the SQL statement reference example, the hierarchical information, the query request and the select field, and obtain the SQL statement by inputting the fourth prompt information into the LLM.

12 . The electronic device according to claim 11 , wherein the at least one processor is further configured to:

obtain a preset candidate query request and determine a target hierarchical level of a query object for the candidate query request; and

determine a query condition example and a select field example for the candidate query request based on the hierarchical information and the field default value; and

generate a SQL statement reference example for the target hierarchical level based on the query condition example, the select field example, and the source of the query result.

13 . The electronic device according to claim 12 , wherein the at least one processor is further configured to:

take the hierarchical information and the SQL statement reference example as first information; and

generate second information based on the query request and the select field; and

obtain a current query time as third information; and

obtain hierarchical information of the query object for the query request as fourth information; and

generate a second target cue word by writing the query request into a second preset cue word; and

obtain the fourth prompt information by splicing the first information, the second information, the third information, the fourth information, and the second target cue word.

14 . The electronic device according to claim 11 , wherein the at least one processor is further configured to:

perform a syntax check on an initial SQL statement output by the LLM; and

in response to determining a syntax error exists, input an error log into the LLM and perform a syntax correction of the initial SQL statement based on the error log until a final SQL statement is obtained.

15 . The electronic device according to claim 9 , wherein the at least one processor is further configured to:

obtaining a query result in a java script object notation (JSON) format by performing a format conversion on the query result; and

obtain a display cue word of the query result, and generate fifth prompt information based on the display cue word and the query result in the JSON format, and obtain a view display result of the query result by inputting the fifth prompt information into the LLM.

16 . A non-transitory computer readable storage medium, storing computer instructions, wherein the computer instructions are caused to enable a computer to perform a method for information processing based on a large language model (LLM), the method comprising

obtaining a query request from a user;

generating first prompt information based on the query request, and obtaining identification information of a query object as a query condition by inputting the first prompt information into the LLM;

generating second prompt information based on the query request and description information of a service table in a database, and obtaining a candidate service table as a source of a query result by inputting the second prompt information into the LLM;

extracting a create schema statement of the candidate service table and generating third prompt information based on the create schema statement and the query request, and obtaining a select field by inputting the third prompt information into the LLM, wherein the create schema statement is a statement for creating a new table;

generating, by the LLM, a structured query language (SQL) statement by combining the query condition, the source of the query result, and the select field; and

obtaining the query result corresponding to the query request, by inputting the SQL statement into the LLM for execution;

wherein generating second prompt information based on the query request and the description information of the service table in the database comprises:

generating table reference information based on the description information of the service table, and generating a first target cue word by writing the query request into a first preset cue word; and

generating the second prompt information by splicing the table reference information and the first target cue word.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 16, 2026
From: LIU, HAOCHENG; XU, HAIYANG
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 075487/0524 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 10, 2026
From: ZHANG, LIANGJIE; SUN, QIAN
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 074027/0192 →
Priority Claims (1)
CN 202311238693.3 · Sep 22, 2023 · national
Continuity (1)
Related Publication 20250005018A1 · Jan 2, 2025
References Cited (5)
US 20240185137A1 · Atlan · 2024 [cited by examiner]
US 20240248896A1 · Boskovic · 2024 [cited by examiner]
US 20240338361A1 · Hazel · 2024 [cited by examiner]
US 20240427567A1 · Murthy · 2024 [cited by examiner]
US 20250021767A1 · Dharnidharka · 2025 [cited by examiner]