AutoGen-based intelligent number asking method and system and electronic equipment

By leveraging the intent understanding and semantic completion mechanisms of the AutoGen intelligent agent platform, and combining them with the model context protocol to generate SQL statements, the slow response and accuracy issues of existing intelligent data retrieval AI products in high-frequency and complex queries have been resolved, achieving more efficient data retrieval.

CN121233731APending Publication Date: 2025-12-30广域铭岛数字科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511400961.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Existing intelligent query AI products are slow to respond to high-frequency queries, have a high error rate for complex queries, cannot accurately understand user needs, have poor adaptability, and cannot generate correct SQL statements, affecting the accuracy and completeness of query results.

Method used

The system acquires user questions through the AutoGen intelligent agent platform, performs intent understanding, recalls view metadata and view field data for semantic completion, assembles question data services based on the model context protocol, and calls the large model to generate SQL statements for querying.

Benefits of technology

It improves the success rate of intent recognition, reduces unnecessary large model calls, enhances the accuracy of SQL statement generation, and improves the accuracy and efficiency of data retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121233731A_ABST
    Figure CN121233731A_ABST
Patent Text Reader

Abstract

The invention provides an AutoGen-based intelligent number asking method and system and electronic device.The method comprises the steps that a user question is obtained, intention understanding is conducted on the user question, and the user question is acquired by an AutoGen intelligent agent platform from a terminal; if the user intention recognition fails, recalling view metadata and view field data according to entities in the user question, performing semantic completion on the view metadata and the view field data, and determining the user intention; assembling the user intention, the entity, the view metadata and the view field data based on a model context protocol to generate a number asking service; and calling the large model to generate an SQL statement according to the question number service input cue word, executing SQL statement query, determining target data, and outputting the target data. Through an entity recall and semantic completion mechanism, the intention recognition success rate is greatly improved, meanwhile, the understanding ability and the accurate query technology of a large model are improved, and the accuracy of data retrieval is also improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of data querying or artificial intelligence, and in particular to an intelligent data querying method, system, and electronic device based on AutoGen. Background Technology

[0002] With the rapid development of artificial intelligence technology, large-scale intelligent question answering systems have been widely applied in various fields. In recent years, large language models (LLMs) have made breakthrough progress in the field of natural language processing. LLMs perform well in understanding semantics, capturing contextual information, and performing complex reasoning. They can better handle complex and diverse natural language problems and generate more accurate and efficient SQL queries.

[0003] While intelligent data retrieval can be performed quickly using natural language, and some intelligent data retrieval AI products exist, most commercially available intelligent data retrieval AI products generate SQL from large models based on natural language and table structure metadata, and then execute the SQL query to display the data through an execution engine. However, they have the following drawbacks: First, over-reliance on a single large language model to handle all aspects leads to slow response times for high-frequency queries and a sharp increase in error rates when faced with complex queries. Second, the inability to accurately understand users' natural language queries results in a failure to accurately understand business needs, leading to irrelevant answers. Third, for some complex, non-standard, or flexible query requirements, the model has poor adaptability and cannot accurately generate correct SQL statements, thus affecting the accuracy and completeness of query results. Summary of the Invention

[0004] This application provides an intelligent questioning method, system, and electronic device based on AutoGen to solve the problem that the existing technology cannot accurately understand user questions, resulting in poor accuracy of the processing results provided by intelligent questioning.

[0005] This application provides an intelligent question-and-answer method based on AutoGen, comprising: acquiring user questions and performing intent understanding on the user questions, wherein the user questions are collected from the terminal by the AutoGen intelligent agent platform; if user intent recognition fails, retrieving view metadata and view field data based on the entities in the user questions, performing semantic completion on the view metadata and view field data to determine the user intent; assembling the user intent, entities, view metadata, and view field data based on the model context protocol to generate a question-and-answer service; calling the large model to generate SQL statements using the input prompts of the question-and-answer service, executing the SQL statement query, determining the target data, and outputting it.

[0006] In some embodiments of this application, retrieving view metadata and view field data based on entities in a user question includes: extracting entities from the user question and converting the entities into entity vectors from a metadata service; retrieving view metadata from a vector database based on the entity vectors, calculating the similarity between the entity vectors and the view metadata, and determining whether a view is matched based on the similarity; if a view is matched, retrieving view field data based on the view ID and the entity; if a view is not matched, rewriting the question, entity, and time based on a multi-turn dialogue to obtain new view metadata, and retrieving view field data based on the new view ID and the entity.

[0007] In some embodiments of this application, before recalling view metadata in the vector database based on the entity vector, the method further includes: matching and recalling synonym vectors of the entity vector; optimizing each entity vector with at least one synonym vector to determine the final entity vector.

[0008] In some embodiments of this application, semantic completion is performed on view metadata and view field data to determine user intent, including: obtaining the view that the user responds to through page guidance data on the terminal; filling the view metadata with semantic completion based on the view's business scenario, purpose, and associated business entities according to a preset first user slot; filling the view field data with semantic completion based on the business entity's name, semantic explanation, associated fields, and calculation logic according to a preset second user slot; and determining user intent based on the semantic association between the semantically completed view metadata and view field data.

[0009] In some embodiments of this application, user intent, entity, view metadata, and view field data are assembled based on the model context protocol to generate a question and answer service, including: assembling user intent, entity, view metadata, and view field data based on the model context protocol to generate a structured requirement document; converting the structured requirement document into a data file in a preset format, and integrating it with the protocol version number and timestamp to form a question and answer service that conforms to the complete context of the protocol.

[0010] In some embodiments of this application, the input prompt words of the question service are used to call the large model to generate SQL statements, including: integrating the natural language input by the user in the question service, view metadata, view field data, and constraints for generating SQL into prompt words; calling the application programming interface of the large model through the prompt words, and converting the question service into executable SQL statements through the virtualization engine.

[0011] In some embodiments of this application, determining target data and outputting it includes at least one of the following: generating a visualization chart based on the data content and business scenario of the target data; optimizing and refining the target data to generate a summary; and recommending related potential questions based on the user's current query question to guide the user in data analysis.

[0012] In some embodiments of this application, the method further includes: constructing a relational table with a composite index, using the regional element corresponding to each time element as a column field and the field element as a row field; the relational table being determined as a wide table or a long table based on the granularity of the time dimension and the number of regional dimensions; obtaining target data according to an SQL statement and populating the target data into the relational table; drawing a visualization chart of the relational tables of all time elements; sorting the data in each relational table according to the values ​​of the field elements and summing them by column, and calculating the proportion of each field element value to the total sum of the corresponding column at the current time; using each relational table and its corresponding summation result and proportion calculation result as input, generating a text description summarizing the field elements using a large model; concatenating the text descriptions of each field element to obtain the target text, evaluating the quality of the target text based on preset automated indicators, and outputting the target text that meets the preset quality; using the visualization chart and the target text as the output result of the current query, and recommending the related question as a candidate question for the next round of query to the user.

[0013] This application also provides an intelligent question-and-answer system based on AutoGen, comprising: an intent understanding module for acquiring user questions and understanding their intent, wherein the user questions are collected from the terminal by the AutoGen intelligent agent platform; an intent determination module for retrieving view metadata and view field data based on entities in the user question if user intent recognition fails, performing semantic completion on the view metadata and view field data to determine the user intent; a question-and-answer service module for assembling user intent, entities, view metadata, and view field data based on the model context protocol to generate a question-and-answer service; and a query response module for calling the large model to generate an SQL statement based on the input prompts of the question-and-answer service, executing the SQL statement query, determining the target data, and outputting it.

[0014] This application also provides an electronic device, including a processor, a memory, and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the AutoGen-based intelligent questioning system described above.

[0015] The beneficial effects of this application are as follows: The intelligent question counting method, system, and electronic device proposed in this application, based on AutoGen, understands the intent of user questions. If user intent recognition fails, it recalls view metadata and view field data based on entities in the user question, performs semantic completion on the view metadata and view field data, and determines the user intent. Based on the model context protocol, it assembles the user intent, entities, view metadata, and view field data to generate a question counting service. The input prompt words of the question counting service call the large model to generate SQL statements, execute the SQL query, determine the target data, and output it. Through entity recall and semantic completion mechanisms, the success rate of intent recognition is greatly improved. At the same time, the use of the model context protocol achieves standardized docking, and the intent recognition failure trigger mechanism reduces unnecessary calls to the large model. In addition, the combination of semantically enhanced prompt word engineering and metadata constraints improves the accuracy of SQL statement generation, enhances the understanding ability and precise query technology of the large model, and also improves the accuracy of data retrieval. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0017] In the attached diagram: Figure 1 A flowchart of an intelligent question-and-answer method based on AutoGen provided in an embodiment of this application; Figure 2 A flowchart illustrating the principle of an intelligent question-answering method based on AutoGen provided in an embodiment of this application; Figure 3 A complete flowchart of an intelligent question-answering method based on AutoGen provided in an embodiment of this application; Figure 4 A structural block diagram of an intelligent question-and-answer system based on AutoGen provided in an embodiment of this application; Figure 5 This application provides an overall architecture block diagram of an intelligent question-and-answer system based on AutoGen, as an embodiment of the present application. Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0018] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0019] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the shape, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0020] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.

[0021] Related technologies in intelligent question-answering systems that convert natural language to SQL suffer from three core problems: First, insufficient robustness in user intent recognition; when user questions are vague, contain domain terminology, or lack context, intent recognition is prone to failure. Second, the lack of a standardized mechanism for model context management leads to low data transfer efficiency and poor compatibility between multiple modules. Third, SQL generation relies excessively on the capabilities of large models, resulting in inaccurate generation, high costs, and poor interpretability. This is particularly problematic in industrial intelligent agent scenarios, where equipment data queries involve numerous technical terms and complex data structures. Existing solutions lack effective fallback mechanisms after intent understanding failures, often requiring manual intervention to complete the query task. To address the aforementioned problems, this application provides an intelligent question-and-answer method, system, and electronic device based on AutoGen, with reference to... Figure 1 , Figure 1 A flowchart illustrating an embodiment of the intelligent question-answering method based on AutoGen provided in this application includes: Step S110: Obtain the user question and perform intent understanding on the user question. The user question is collected from the terminal by the AutoGen intelligent agent platform. Among them, the AutoGen intelligent agent platform is a framework for multi-agent collaborative work. It realizes data collection, analysis and decision support through distributed intelligent agents. In industrial scenarios, it often uses protocols such as OPC unified architecture and MQTT (message queue telemetry transmission) for terminal data interaction.

[0022] Terminals include, but are not limited to, smart devices such as tablets, computers, mobile phones, and wearable devices, which obtain user input via client or web page within the terminal.

[0023] For example, semantic understanding based on a pre-trained language model involves training the language model with a large amount of labeled data to identify query intents in a specific domain, mapping user questions to a predefined intent category space, and determining the effectiveness of the identification by calculating a confidence threshold.

[0024] Specifically, the terminal submits a query request through the API interface of the AutoGen intelligent agent platform. The platform preprocesses the original question, including word segmentation, entity recognition, and syntactic analysis; it calls a pre-trained language model to classify the user's intent; and it determines whether the intent recognition is successful based on the classification result. If successful, it continues to execute; otherwise, it triggers a semantic completion mechanism.

[0025] Optionally, mapping rules between domain keywords and intents can be manually defined and matched with classification models to improve the accuracy of identifying complex problems; when a low confidence level is detected, the user is asked to provide additional key information.

[0026] Step S120: If user intent recognition fails, retrieve view metadata and view field data based on the entities in the user question, perform semantic completion on the view metadata and view field data, and determine the user intent. For example, a domain knowledge network is established using the triple representation (entity-relationship-entity) of the knowledge graph. When the user's intent is missing key information, potential associations are mined from the metadata through entity linking and relation reasoning techniques to achieve automatic intent completion. By combining embedding-based and text-based methods, entity similarity is calculated in a low-dimensional vector space to infer the missing relationship.

[0027] Specifically, entity information, such as device ID, time range, and metric name, is extracted from user queries; relevant view metadata and view field data are retrieved from the metadata repository based on entity type; an entity relationship graph is constructed, and knowledge graph completion technology is used to identify missing semantic relationships; semantic enhancement prompts are generated through the CP-KGC framework (constraint hint knowledge graph completion) to supplement missing information in the user intent; and intent recognition is performed again to form a complete query intent.

[0028] Optionally, a completion template can be designed based on common missing patterns, and missing information can be filled in by keyword matching; or, if intent recognition fails, manual intervention and annotation can be requested, while the model training data can be optimized; and the zero-shot capability of a large model can be used to generate completion options for users to choose from.

[0029] Step S130: Based on the model context protocol, the user intent, entity, view metadata and view field data are assembled to generate the question data service; For example, the context data structure is defined according to the MCP protocol specification, including metadata such as model ID, timestamp, and user information; user intent, entity information, view metadata, and view field data are mapped to the corresponding fields of the protocol, and the data is serialized using JSON or Protobuf format.

[0030] Step S140: The input prompt words of the question service are used to call the large model to generate SQL statements, execute the SQL statement query, determine the target data, and output it.

[0031] For example, the contextual understanding and code generation capabilities of large models are leveraged to generate SQL statements that conform to grammatical rules, combined with domain knowledge; the output format of the model is constrained by prompt words, and database metadata is used to ensure that the generated SQL matches the actual table structure; for complex queries, the thought chain technique can be used to guide the model to reason step by step.

[0032] Specifically, the structured data from the Qwen service is converted into natural language prompts that the large model can understand; the prompts include descriptions of user intent, database schema information, and formatting requirements; the large model (such as GPT-4 or Qwen-7B-Chat) is invoked to generate initial SQL statements; the generated SQL statements are syntax-checked and logically optimized; the SQL queries are executed and the result data is retrieved, and the result data returned by the SQL queries is received; an appropriate display method is selected based on user intent and data type; necessary data formatting is performed, such as unit conversion and outlier annotation; and the final results are presented through API calls or user interfaces.

[0033] Optionally, query keywords are extracted and mapped to SQL statements through a rule engine. For example, LLM extracts keyword rules and converts them into SQL patterns. Domain-specific labeled data is used to fine-tune a dedicated SQL statement generation model to improve accuracy in specific scenarios. A large model generates SQL statements, which are then optimized for performance using a dedicated SQL statement optimizer.

[0034] The above methods are used to understand user intent in questions. If user intent recognition fails, the view metadata and view field data are retrieved based on the entities in the user question. Semantic completion is performed on the view metadata and view field data to determine the user intent. The user intent, entities, view metadata, and view field data are assembled based on the model context protocol to generate a question data service. The input prompt words of the question data service are used to call the large model to generate SQL statements, execute the SQL query, determine the target data, and output it. Through entity retrieval and semantic completion mechanisms, the success rate of intent recognition is greatly improved. At the same time, standardized integration is achieved using the model context protocol, and unnecessary calls to the large model are reduced through the intent recognition failure trigger mechanism. In addition, this application combines semantically enhanced prompt word engineering and metadata constraints to improve the accuracy of SQL statement generation, enhance the understanding ability and precise query technology of the large model, and improve the accuracy of data retrieval.

[0035] In some embodiments, view metadata and view field data are retrieved based on entities in the user question, including: Extract the entities from the user's question and convert them into entity vectors for the metadata service; Retrieve view metadata from the vector database based on entity vectors, calculate the similarity between entity vectors and view metadata, and determine whether the view is matched based on the similarity. If a view is identified as a match, retrieve the view field data based on the view ID and the entity. If a view is determined to be missing, the question, entity, and time are rewritten based on the multi-turn dialogue to obtain new view metadata, and view field data is retrieved based on the new view ID and entity.

[0036] For example, user questions are preprocessed, including but not limited to word segmentation, stop word removal, and part-of-speech tagging. A named entity recognition model is called, such as a domain-fine-tuned NER model based on BERT, to extract business entities from the question and output entity types and entity values. The extracted entities are cleaned using a domain dictionary. The vector generation interface in the metadata service is called, and the standardized entities (including type and value) are input. The entities are mapped to fixed-dimensional entity vectors through a pre-trained semantic model. The vectors must contain entity type semantics and entity value semantics. Entity vectors are generated and associated with the user session ID for subsequent view metadata retrieval. All view metadata is pre-converted into vectors with view names and associated entity types, stored in a vector database, and a unique view ID is associated with each view metadata vector. The entity vector of the user question is retrieved from the cache, and a retrieval request is sent to the vector database with a set recall count. After the vector database returns the recalled view metadata vectors, the cosine similarity between each view metadata vector and the entity vector is calculated. The calculated similarity is compared with a preset threshold. If at least one view metadata has a similarity greater than or equal to the preset threshold, the view is considered a match, and the view metadata with the highest similarity and its corresponding view ID are selected. If the similarity of all view metadata is less than the preset threshold, the view is considered a miss. Using the view ID of the match view as a condition, a view field data query statement is constructed based on the entity values ​​in the user question. The query statement is sent to the view field data warehouse, and a retrieval operation is performed to obtain all view field data matching the entity values ​​under that view. Invalid data is filtered based on the field value range, and the consistency between the field type and the entity value type is verified. The verified view field data is then organized in the format of field name – business meaning – field value. After determining a miss, the missing entity points are analyzed, and guiding questions are generated. Receive user feedback and extract the supplemented entities; integrate the supplemented entities into the original user question to generate a rewritten question, and update the entity vector; send the rewritten question and the updated entity vector to the metadata service. If a matching existing view metadata exists, obtain its view ID; if not, temporarily generate new view metadata and register it in the vector database; use the same process as the hit view to retrieve view field data based on the new view ID and entity value.

[0037] Compared to traditional keyword matching, the semantic representation of entity vectors can effectively handle synonymous and polysemous entity problems. Combined with similarity judgment in the vector database, it improves the accuracy of view metadata retrieval. The multi-turn dialogue rewriting mechanism improves the success rate of process continuation when the view is not hit. The low-dimensional representation of entity vectors and the index optimization of the vector database shorten the view metadata retrieval time. At the same time, the on-demand field retrieval when the view is hit reduces the amount of data transmission and reduces server bandwidth consumption.

[0038] In some embodiments, before recalling view metadata in the vector database based on the entity vector, the method further includes: Match the synonym vectors of the entity vectors and recall them; Each entity vector is optimized by using at least one synonym vector to determine the final entity vector.

[0039] By employing the above method, real-time analysis of user issues yields key entities, such as the MTTR (Mean Time To Repair) for a factory and its workshop this year. This process obtains the entities "factory," "workshop," and "MTTR," and utilizes entity-to-metadata service vectors to retrieve stored synonym data. The prerequisite is user-configured synonym terms; for example, if MTTR represents 'Mean Time To Repair,' then the user issue is understood as the average repair time for a factory and its workshop. This improves the user's ability to use specialized terminology and supports dynamic terminology configuration. Simultaneously, it enhances the understanding and accuracy of user issues.

[0040] In some embodiments, semantic completion is performed on view metadata and view field data to determine user intent, including: Obtain the user's response view through the terminal's page guidance data; The business scenarios, uses, and associated business entities based on the view are filled in according to the preset first user slot, and the view metadata is semantically completed. Based on the business entity's name, semantic explanation, associated fields, and calculation logic, the data is filled according to the preset second user slot, and the view field data is semantically completed. The user intent is determined based on the semantic association between the view metadata and view field data after semantic completion.

[0041] For example, the terminal loads a preset view guidance page. The page is designed in layers according to basic attributes, business attributes, and associated entities. Users fill in or select information item by item according to the page guidance, and the input content is validated in real time. If it does not conform to the rules, a prompt appears. After the user submits, the system checks the data integrity based on preset validation rules. If there are any missing items, the system locates the missing items and prompts the user to supplement them. After successful validation, the system stores the user's response view data in the view database and associates it with the user session ID and terminal device information for subsequent metadata completion processes. The system loads the first user slot structure from the configuration center and initializes the attributes of each sub-slot. The applicable business scenario selection results are filled into the business scenario slot. If the user's remarks include a usage description, this information is extracted and filled into the usage slot; otherwise, the default value is used for general data analysis. The core associated business entity selection results are filled into the associated business entity slot. The data in each sub-slot is checked; if any are missing, the business knowledge base is invoked to recommend completion content, prompting the user for confirmation. After user confirmation, the first user slot data is merged with the original view's basic metadata to generate semantically complete view metadata, which is then stored in the metadata repository. The second user slot structure is loaded from the configuration center. Based on the information of the associated business entity slots of the first user slot, the field list corresponding to the business entity is filtered, and an independent second user slot is initialized for each field. The associated business entity name is automatically filled in. Information is extracted from the business dictionary for filling first; if no information is found, the user is prompted to input it. Based on the business relationships between fields, associated fields are filtered from the view field list and filled in; the user can manually adjust these fields. If a field is a derived field, it is retrieved from the calculation logic template library, filled into the template, and replaced with the specific field name; if no matching template is found, the user is prompted to input a formula. The validity of the formula in the calculation logic slot and the uniqueness of the semantic interpretation slot are verified. After successful verification, semantically complete view field data is generated and associated view metadata is stored. The extracted association features are input into the user intent classification model. Based on the association feature-intent category mapping relationship learned during training, the model outputs the intent category and its corresponding confidence score. If the confidence level is greater than or equal to a preset threshold, for example, the preset threshold can be set to 0.8 as needed, then the user intent is determined; if the confidence level is less than the preset threshold, then a list of intent candidates is generated, and the user is prompted to select and confirm through the terminal; after determining the user intent, the intent result is associated with and stored with view metadata and view field data.

[0042] By utilizing the first user slot completion method, the semantic information coverage of view metadata is improved, solving the problem of knowing only the view structure but not the business purpose; the second user slot completion method improves the semantic interpretation coverage of view field data, enhancing the integrity of the computational logic; the view field data association verification mechanism enables the fusion and judgment of derived fields, dimension semantic association features, and models, improving the accuracy of user intent classification.

[0043] In some embodiments, user intent, entities, view metadata, and view field data are assembled based on the model context protocol to generate a question-and-answer service, including: Based on the model context protocol, user intent, entities, view metadata and view field data are assembled to generate a structured requirements document; The structured requirements document is converted into a data file in a preset format, and then combined with the protocol version number and timestamp to form a question and answer service that conforms to the complete context of the protocol.

[0044] Through the above methods, the standardized mapping of the MCP protocol improves the accuracy of the association between intent, entity, metadata, and view field data; the JSON / Protobuf serialization format of the structured requirements document reduces the data transmission volume and transmission time compared to traditional fragmented data transmission; the checksum and digital signature mechanism improves the data tampering detection rate of the query service; and the standardized query service eliminates the need for downstream modules to handle data format conversion and verification logic, reducing development workload.

[0045] In some embodiments, the input prompt words of the question-and-answer service are used to call the large model to generate SQL statements, including: The system integrates the natural language input by the user in the query service, view metadata, view field data, and the constraints of the generated SQL into prompt words. The system uses prompt words to call the application programming interface of the large model, and the virtualization engine transforms the query service into executable SQL statements.

[0046] Through the above methods, the integration of structured prompts improves the completeness of elements acquired from large models; scenario-based API parameter configuration reduces the cost per call; the automation rate of the entire process from query service to executable SQL is increased; the permission verification mechanism of the virtualization engine achieves a high rate of interception of unauthorized SQL queries; and through precise guidance from prompts and virtualization verification, the end-to-end process of user needs, query service, and executable SQL is streamlined.

[0047] In some embodiments, target data is determined and output, including at least one of the following: Generate visual charts based on the data content and business scenario of the target data; Optimize and refine the target data to generate a summary; Based on the user's current query, related potential questions are recommended to guide the user in data analysis.

[0048] Specifically, the specific implementation methods of the above embodiments further include: Each time element corresponds to a regional element as a column field, and the field element is used as a row field to construct a related table with a composite index. The related table is determined to be a wide table or a long table based on the granularity of the time dimension and the number of regional dimensions. Retrieve the target data based on the SQL statement and populate the related table with the target data; Create a visual chart showing the relationships between all time elements; Sort the data in each associated table according to the values ​​of the field elements and sum them by column, and calculate the proportion of each field element value to the total sum of the corresponding column at the current time; Each associated table and its corresponding summation and ratio calculation results are used as input to generate a text description summarizing the field elements using the large model; The text descriptions of each field element are concatenated to obtain the target text. The quality of the target text is evaluated based on preset automated indicators, and the target text that meets the preset quality is output. The current query outputs a visual chart and the target text, and related questions are recommended as candidate questions for the user's next query.

[0049] For example, by dynamically matching time granularity with the number of regions, the optimal table structure is selected. For instance, wide tables reduce the number of rows, and long tables reduce the number of columns, balancing storage and query efficiency. Composite indexes are used for time-region joint queries, reducing disk I / O through index ordering. This addresses the poor adaptability of fixed table structures by driving table structure design through dimensional features. Based on structured data mapping and standardized cleaning logic, a field mapping rule base reduces manual intervention, data cleaning ensures the validity of populated data, and batch insertion optimizes filling efficiency. Simultaneously, the ordered conversion of unstructured SQL results into structured data in related tables solves the problems of poor data filling adaptability and low efficiency. Based on aggregation functions and proportional derivation, sorting highlights core data, column summation provides an overall data perspective, and proportional calculation displays field contribution. Based on structured data input and contextualized prompts, the core logic is guided by structured data to avoid misunderstandings of the original table data by large models, contextualized prompts ensure text style matches user identity, and iterative optimization improves text quality. This quantifies the data-to-natural language interpretation conversion, solving the problem of lack of depth and flexibility in traditional template-generated text. Based on the core logic of multi-dimensional quantitative evaluation and query intent extension, it ensures controllable text quality through automated indicators, generates candidate questions through intent extension, and creates a closed loop of text generation, quality control, and demand continuation, thus solving the problems of unstable text quality and query gaps.

[0050] Through the above methods, matching data features with chart types improves information transmission efficiency; interactive controls allow users to explore data autonomously without relying on technical personnel to adjust charts; ensuring the accuracy and added value of data calculations: automation of sorting, summation, and ratio calculations reduces calculation error rates, and parallel computing shortens the processing time for large amounts of data; calculation results provide quantitative support for text descriptions, enhancing the credibility of text conclusions and ensuring the accuracy and added value of data calculations: structured prompts and large model generation improve text accuracy and completeness, and the use of professional terminology in texts is enhanced through domain knowledge bases, meeting the needs of professional scenarios such as operation and maintenance and finance.

[0051] Optionally, in some embodiments, please refer to Figure 2The schematic diagram of the principle flow of the intelligent question-answering method based on AutoGen provided in one embodiment of this application also includes: By using intent-understanding completion and human-computer interaction completion information, we can improve the accuracy of user questions. Real-time analysis of user issues reveals key entities. For example, the MTTR (Mean Time To Repair) for a factory and workshop this year. This yields the entities "Factory One," "Workshop One," and "MTTR." The entity-to-metadata service vector retrieves stored synonym data, meaning the preceding information is user-configured synonym terms. For instance, MTTR represents Mean Time To Repair, so the user's issue is understood as the Mean Time To Repair for a Factory and Workshop One. This provides the user with the ability to use specialized terminology and supports dynamic terminology configuration, improving the understanding and accuracy of user issues.

[0052] Based on entity vectors, the retrieved view metadata is used to reorder the retrieved data for business matching. This includes ① string matching accuracy, ② rematching after concatenating entities, and ③ matching the original question with the retrieved data. When the intent is unclear, manual view guidance will be provided via WebSocket for real-time interaction, improving user experience and question accuracy. For example, if a user asks about the average completion rate for the month, and there are completion rates for the R&D domain and the product domain, the user will be guided to select and confirm.

[0053] Based on the entity recall view field data, the recalled data is reordered according to business matching. When there is unclear intent, including two scenarios: one is when multiple field values ​​are identical, allowing the user to select the appropriate field; the other is when the user's question information is incomplete, in which case manual guidance on field values ​​will be provided via WebSocket for real-time interaction, improving user experience and question accuracy. For example, if the view contains two fields, "Construction Worker Name" and "Dispatcher Name," and the user asks about Li Ming's completion rate for the current month, field completion is required; similarly, if the user asks about our company's suppliers this year, and the recalled data includes our company's name, the user needs to confirm and complete the data.

[0054] Once the intent is clear, the process moves to subsequent data queries. If the user's view recall proves ineffective, the system will guide them through multiple rounds of follow-up questions.

[0055] By leveraging intent understanding and multi-turn dialogue rewriting, the system enables users to ask follow-up questions. First, when a user initiates the current question and the retrieved view is invalid, the system queries the previous question and uses a large model to determine the correlation between the current and previous questions (follow-up scenarios include time-based follow-ups, space-based follow-ups (value conditions and aggregation conditions), causal inquiries, etc.), rewriting the multi-turn question. It directly uses the view metadata from the previous dialogue to rewrite the question entity retrieved data, providing guidance if the intent is unclear.

[0056] Once the intent is clear, the process moves to subsequent data queries. If multiple rounds of evaluation prove ineffective, the user is guided to ask the question again.

[0057] Please see Figure 3 The flowchart of an intelligent question-and-answer method based on AutoGen provided in an embodiment of this application is described in detail below: 1) The user submits a question to the terminal page. 2) The problem-understanding agent carries three rounds of dialogue data and the current question's call to the question intent understanding MCP. 3) Enable large model time extraction and entity extraction tasks in the Question Data service. 4) Based on the extracted entity recall synonym data, the view metadata confirms the view. 5) Determine if the view is hit. If the view metadata is hit, the query service retrieves the view field data based on the view ID and extracted entity, returns the view metadata, and determines whether the view semantics are clear. If not, it guides the view semantic completion and retrieves the view field data through the entity after completion. 6) If multiple metadata matches exist, return the bootstrap data. 7) If the view metadata is not hit; rewrite the three-round dialogue with multiple rounds of questions; use the view metadata from the previous round of dialogue to retrieve view field data based on the view ID and extracted entity. Similarly, determine whether the field semantics are clear; if not, guide the completion of field semantics. 8) Understanding the intent of an intelligent agent requires human-machine guidance from the user. 8.1 Return to Terminal Page Guide Data 8.2 User Selection View 8.3 Human-Computer Interaction Intelligent Agent Calls Question Number User Filling Slot MCP 8.4 Question Recall View Metadata and View Field Data 8.5 Returning View Metadata to the Intent Understanding Agent 9) After the intent-understanding agent obtains the metadata, it flows to the data query agent. 10) The data query agent calls the question dataset to query the MCP. 10.1 Assembly issues, metadata, entity, implementation, and view field data information 10.2 Generating Query SQL by Calling Large Model Using Prompt Keywords 10.3 will generate SQL to call the virtualization engine to query view data. 10.4 Returns query field information and data 11) Data query: Intelligent agent data flow: 11.1 Chart Recommendation: Intelligent Agent Calls Question Chart Recommendation, MCP Recommendation Chart 11.2 Summary of the intelligent agent's summary of the data 11.3 Problem Recommendation: Intelligent Agent Calls Question Number Recommendation MCP Recommendation Problem like Figure 4 As shown, the Agent platform performs question understanding and human-computer interaction; while the question data service includes intent understanding MCP, synonym data, view metadata, view field (value) data RAG recall, and whether the metadata is hit. After human-computer interaction, the user fills in the slot MCP to supplement user information and returns intent understanding information, which includes human-computer dialogue information; at the same time, if the metadata is not hit, the question, time and entity are returned through multiple rewrites to realize view metadata and view field (value) data RAG recall, thereby performing intent understanding; otherwise, if the metadata is hit, the intent understanding information is returned directly.

[0058] The Agent platform determines whether to fill in the human-computer interaction slot based on whether the intent of the question is clear. If the intent is clear, there is no need to fill in the human-computer interaction slot. It executes the dataset query agent, generates the dataset query MCP, and combines the question, metadata, entities, and time to call the large model to execute the NL2SQL task. It returns the SQL, queries the data by calling the virtualization engine, and returns it to the Agent platform. Based on the data summary, chart data and question recommendation, it executes the corresponding response.

[0059] In this way, on the one hand, the natural language input by users can be converted into corresponding SQL query statements, which lowers the operation threshold and enables a wider range of users to easily master complex database query operations; on the other hand, it realizes the accurate identification of industry indicator elements in natural language query statements, improves the structured parsing capability of query elements, and ultimately improves the query accuracy.

[0060] Please refer to Figure 4 This embodiment of the application also provides a structural block diagram of an intelligent question-and-answer system based on AutoGen, including: The intent understanding module 410 is used to acquire user questions and perform intent understanding on user questions. The user questions are collected from the terminal by the AutoGen intelligent agent platform. The intent determination module 420 is used to retrieve view metadata and view field data based on the entities in the user question if the user intent recognition fails, and to perform semantic completion on the view metadata and view field data to determine the user intent. The Question Data Service Module 430 assembles user intent, entity, view metadata, and view field data based on the Model Context Protocol to generate the Question Data Service. The query response module 440 is used to call the large model to generate SQL statements based on the input prompts from the query service, execute the SQL query, determine the target data, and output it.

[0061] It should be noted that the intelligent questioning system based on AutoGen and the intelligent questioning method based on AutoGen provided in the above embodiments belong to the same concept. The specific way each module performs its operations has been described in detail in the method embodiments and will not be repeated here. In practical applications, the intelligent questioning method based on AutoGen provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0062] like Figure 5 The diagram shown is an overall architecture block diagram of an intelligent query system based on AutoGen provided in an embodiment of this application. It converts users' natural language queries into queries for business data and displays the data results, as detailed below: The AutoGen intelligent agent platform comprises five modules: Agent Platform, Question Data Service, Large Model Service, Metadata Service, and Virtualization Engine Service (SQL Execution Engine). The Agent Platform enables the orchestration of multiple intelligent agent processes, providing question data capabilities, including human-computer interaction, data summarization, chart recommendation, and question recommendation. The Question Data Service implements functions such as intent understanding, vector recall, multi-round rewriting, entity extraction, thought chaining, SQL generation, engine SQL data querying, and question and chart recommendation. Each function corresponds to one intelligent agent. The Virtualization Engine Service provides data view capabilities (single-table views and multi-table join views), view metadata vectorization, data vectorization, and view SQL execution query capabilities. The Metadata Service provides view metadata and view field data vectorization, as well as recall capabilities.

[0063] The above approach involves understanding the user's intent in the question. If intent recognition fails, the system retrieves view metadata and field data based on the entities in the question, performs semantic completion on the view metadata and field data, and determines the user's intent. Based on the model context protocol, the user intent, entities, view metadata, and view field data are assembled to generate a question data service. The input prompts from the question data service are then used to call the large model to generate SQL statements, execute the SQL queries, determine the target data, and output it. This entity retrieval and semantic completion mechanism significantly improves the success rate of intent recognition. Furthermore, the use of the model context protocol enables standardized integration, and the intent recognition failure trigger mechanism reduces unnecessary calls to the large model. In addition, the combination of semantically enhanced prompt engineering and metadata constraints improves the accuracy of SQL statement generation, enhances the understanding capabilities and precise query technology of the large model, and also improves the accuracy of data retrieval.

[0064] In some embodiments, an electronic device is also provided, which may be a server, and its internal structure diagram is shown below. Figure 6 As shown, the electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. The computer program is executed by the processor to implement the functions or steps of the server-side method described above.

[0065] In some embodiments, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: The system acquires user questions and performs intent understanding on them. These user questions are collected from the terminal by the AutoGen intelligent agent platform. If user intent recognition fails, the system retrieves view metadata and view field data based on the entities in the user question, performs semantic completion on the view metadata and view field data, and determines the user intent. Based on the model context protocol, the system assembles the user intent, entities, view metadata, and view field data to generate a question data service. The system then uses the input prompt words of the question data service to call the large model to generate an SQL statement, executes the SQL query, determines the target data, and outputs it.

[0066] In some embodiments, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps: The system acquires user questions and performs intent understanding on them. These user questions are collected from the terminal by the AutoGen intelligent agent platform. If user intent recognition fails, the system retrieves view metadata and view field data based on the entities in the user question, performs semantic completion on the view metadata and view field data, and determines the user intent. Based on the model context protocol, the system assembles the user intent, entities, view metadata, and view field data to generate a question data service. The system then uses the input prompt words of the question data service to call the large model to generate an SQL statement, executes the SQL query, determines the target data, and outputs it.

[0067] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or electronic device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0068] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0069] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. An AutoGen-based intelligent query method, characterized in that, The method comprises the following steps: acquiring a user question and performing intent understanding on the user question, wherein the user question is collected by an AutoGen intelligent agent platform from a terminal; if user intent recognition fails, recalling view metadata and view field data according to an entity in the user question, performing semantic completion on the view metadata and the view field data, and determining a user intent; assembling the user intent, the entity, the view metadata, and the view field data based on a model context protocol to generate a question service; inputting the question service into a prompt word to call a large model to generate an SQL statement, executing the SQL statement to query, determining target data, and outputting the target data.

2. The AutoGen-based intelligent query method according to claim 1, wherein, The method of recalling view metadata and view field data according to an entity in the user question comprises the following steps: extracting an entity of the user question and converting the entity into an entity vector of a metadata service; recalling the view metadata in a vector database according to the entity vector, calculating the similarity between the entity vector and the view metadata, and judging whether the view is hit based on the similarity; if it is determined that the view is hit, recalling view field data according to the view ID and the entity; if it is determined that the view is not hit, obtaining new view metadata according to a multi-round dialogue rewriting question, entity, and time, and recalling view field data according to a new view ID and the entity.

3. The AutoGen-based intelligent query method according to claim 2, wherein, Before recalling the view metadata in the vector database according to the entity vector, the method further comprises the following steps: matching a synonym vector of the entity vector and recalling the synonym vector; optimizing at least one synonym vector for each entity vector to determine a final entity vector.

4. The AutoGen-based intelligent query method according to claim 1, wherein, The method of performing semantic completion on the view metadata and the view field data to determine a user intent comprises the following steps: obtaining a view of a user response through page guide data of the terminal; performing semantic completion on the view metadata according to a preset first user slot based on a business scenario, use, and associated business entity of the view; performing semantic completion on the view field data according to a preset second user slot based on a name, semantic explanation, associated field, and calculation logic of the business entity; determining a user intent according to the semantic association between the view metadata and the view field data after semantic completion.

5. The AutoGen-based intelligent query method according to any one of claims 1 to 4, characterized in that, The method of assembling the user intent, the entity, the view metadata, and the view field data based on a model context protocol to generate a question service comprises the following steps: assembling the user intent, the entity, the view metadata, and the view field data based on a model context protocol to generate a structured requirement document; converting the structured requirement document into a data file in a preset format, integrating a protocol version number and a timestamp to generate a question service that conforms to a complete context of the protocol.

6. The AutoGen-based intelligent query method according to any one of claims 1 to 4, characterized in that, The method of inputting the question service into a prompt word to call a large model to generate an SQL statement comprises the following steps: integrating a natural language input by a user in the question service, the view metadata, the view field data, and a constraint condition for generating an SQL into a prompt word; An application programming interface of the large model is invoked by a prompt word, and the question service is converted into an executable SQL statement by a virtualization engine.

7. The AutoGen-based intelligent query method according to any one of claims 1 to 4, characterized in that, The target data is determined and output, including at least one of the following: A visual chart is generated according to the data content and business scenario of the target data; Optimization analysis and extraction are performed on the target data to generate a summary; Based on the user's current query, the associated potential question is recommended to guide the user to perform data analysis.

8. The AutoGen-based intelligent query method according to claim 7, characterized in that, Further comprising: Each time element corresponding to the area element is taken as a column field, and the field element is taken as a row field, to construct an associated table with a composite index, which is determined as a wide table or a long table based on the time dimension granularity and the number of area dimensions; The target data is obtained according to the SQL statement, and the target data is filled into the associated table; The associated table of all time elements is drawn into a visual chart; The data in each associated table is sorted according to the numerical value of the field element and summed by column, and the proportion of each field element value to the total sum of the corresponding column at the current time is calculated; Each associated table and its corresponding summation result and proportion calculation result are taken as input to generate a text description of the field element summary using a large model; The text descriptions of each field element are spliced to obtain a target text, and the quality of the target text is evaluated based on a preset automatic index, and the target text meeting the preset quality is output; The visual chart and the target text are taken as the output result of the current query, and the associated question is taken as the candidate question for the next round of query recommended to the user.

9. An AutoGen-based intelligent question-answering system, characterized by comprising: Comprise: An intent understanding module for obtaining a user question and performing intent understanding on the user question, the user question being collected by an AutoGen intelligent agent platform from a terminal; An intent determination module for determining a user intent by recalling view metadata and view field data from entities in the user question and performing semantic completion on the view metadata and the view field data if the user intent recognition fails; A question service module for assembling the user intent, the entities, the view metadata and the view field data based on a model context protocol to generate a question service; A query response module for inputting the question service into a prompt word to call a large model to generate a SQL statement, executing the SQL statement query, determining target data, and outputting the target data.

10. An electronic device, comprising: A processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute the computer program stored in the memory to realize the AutoGen-based intelligent question method in any one of claims 1-8.