Self-adaptive SQL generation and intelligent question and answer data processing method for well drilling and completion report
By employing an adaptive drilling and completion report generation and intelligent question-and-answer data processing method, and utilizing a customized model to identify table names and generate SQL query statements that conform to semantic logic, the complexity and accuracy issues of traditional drilling data queries are resolved, achieving efficient and accurate drilling data queries.
Patent Information
- Application Number
- CN202510816122.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-10-17
AI Technical Summary
Traditional SQL query methods suffer from problems in drilling data processing, such as complex query syntax, difficult-to-understand database structure, low accuracy of generated results, and poor result formatting. They are particularly difficult to meet the efficient query needs of non-technical personnel.
An adaptive drilling and completion report generation and intelligent question-and-answer data processing method is adopted. The table name is identified by the 'China-France-7b-chat-1m' model and the SQL query statement that conforms to semantic logic is generated by combining the 'China-France-Coder-32B-Instruct' model. The table structure information is obtained through structured database metadata and the field is completed and formatted for output.
It significantly improves the accuracy and efficiency of drilling data retrieval, and is particularly suitable for complex queries by non-technical personnel. It meets the needs of rapid data retrieval and real-time decision-making at the drilling site, and improves the query accuracy rate to over 95%.
Smart Images

Figure CN120804131A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent query of oil exploration related data, in particular to a drilling completion report adaptive SQL generation and intelligent question and answer data processing method. BACKGROUND
[0002] With the development of drilling technology (especially offshore drilling technology), the amount of field data has increased dramatically, and engineers need to efficiently and accurately query drilling completion data to support decision-making. However, traditional SQL query methods face many challenges in processing such complex data, mainly in the following aspects:
[0003] 1. Complex query syntax, difficult for non-technical personnel to use: Traditional SQL queries require users to have some technical background, especially in complex queries, non-technical personnel often have difficulty mastering the query syntax, resulting in low query efficiency.
[0004] 2. Complex database structure, difficult to understand and adapt: Drilling data involves complex multi-table structures and fields, users often have difficulty quickly understanding the association of data tables, resulting in inaccurate or incorrect query results.
[0005] 3. Low accuracy of generated results: Existing SQL generation methods mostly rely on general large language models to directly generate SQL queries (such as Figure 1 indicated), the accuracy is often less than 70%, which is difficult to meet the enterprise-level needs of high-precision queries.
[0006] 4. Poor result formatting, requiring manual processing: Traditional query results often lack automatic formatting functions and require manual processing after querying, increasing the complexity of subsequent work. SUMMARY
[0007] Therefore, the present application provides a drilling completion report adaptive SQL generation and intelligent question and answer data processing method and system to improve the accuracy of intelligent question and answer and simplify the operation process.
[0008] To achieve the above-mentioned purpose, the technical solution adopted by the present application is as follows: A drilling completion report adaptive SQL generation and intelligent question and answer data processing method, comprising: S1. Receiving user natural language query input; S2. Sending the query input into the "Zhongfa-7b-chat-1m" model to understand the query intent, identifying and outputting the table name in the query input, the "Zhongfa-7b-chat-1m" model is generated after the "internlm2_5-7b-chat-1m" model is fine-tuned by SFT; S3. Access the structured database metadata according to the table name output by the model to obtain the structure information corresponding to the table, including the field name and data type; the structured database is a structured drilling industry database constructed based on PostgreSQL; S4. Input the natural language query input and the obtained table structure information into the "Chinese-French-Coder-32B-Instruct" model to generate a SQL query statement conforming to semantic logic; the "Chinese-French-Coder-32B-Instruct" model is generated by SFT fine-tuning of the "Qwen2.5-Coder-32B-Instruct" model; S5. Execute the generated SQL query statement to return the structured query result, which includes tables and graphs.
[0009] Further, the method further comprises: S6. Determine whether the query result is missing a field related to the query semantics, if so, complete the field and format the output of the query result to generate a standardized query report; or the step S4 further comprises: determining whether the generated SQL query statement is missing a field related to the query semantics, if so, automatically completing the missing field according to the structure of the structured database table and semantic reasoning to ensure the completeness of the query result and the accuracy of the expression.
[0010] Further, the step S1 of receiving the user natural language query input comprises: determining whether the natural language input includes a table name, if not, generating a guide mechanism to guide the user to input the table name.
[0011] Further, the accuracy rate of the table name matching in the step S2 is defined as: Wherein, represents the number of correct table name recognition problems, represents the total number of test problems.
[0012] Further, the generation method of the "Chinese-French-7b-chat-1m" model in the step S2 is: S2.1: Construct a fine-tuning data set for the "internlm2_5-7b-chat-1m" model based on the commonly used databases in the drilling industry, which includes drilling industry specific terms and expression methods; S2.2: Construct a first training data set based on the fine-tuning data set, which includes a large number of natural language query inputs and their corresponding table name labels; S2.3: training the "internlm2_5-7b-chat-1m" model using the first training data set to obtain the "Chin-French-7b-chat-1m" model.
[0013] Further, the generation method of the "Chin-French-Coder-32B-Instruct" model in step S4 is specifically: S4.1: based on the commonly used database in the drilling industry, a fine-tuning data set of the "Qwen2.5-Coder-32B-Instruct" model is constructed, and the commonly used database in the drilling industry includes drilling industry-specific terms and expression methods; S4.2: based on the fine-tuning data set, a second training data set is constructed, which includes a large number of natural language query inputs and corresponding standardized SQL query statements, and corresponding table structure information; S4.3: training the "Qwen2.5-Coder-32B-Instruct" model using the second training data set to obtain the "Chin-French-Coder-32B-Instruct" model.
[0014] Further, the method of accessing structured database metadata in step S3 includes connecting the structured database through the configured data source information, obtaining the table field definition through the information schema INFORMATION_SCHEMA.COLUMNS provided by PostgreSQL or the equivalent pg_catalog metadata interface, including field name, data type, field annotation and constraint condition; The data source information includes structured database type, connection address, port number, structured database name and authentication information.
[0015] Further, before accessing the structured database metadata according to the table name output by the model in step S3, it further includes dynamically sensing whether there is a newly added table or field in the structured database, if there is, automatically updating the structured database to add the newly added table or field; Then pre-load the updated structured database metadata.
[0016] Further, the SQL query statement in step S4 can be abstracted as a semantic triple , wherein is the table name, is the field set, is the constraint condition, and the standard SQL query statement is in the form of: .
[0017] Further, the method further includes: S7: Post-processing operations are performed on the query results, including sorting, filtering, aggregation, grouping statistics, and perspective analysis, to meet the diverse analysis needs of users.
[0018] Compared with the prior art, the beneficial effects of the present application are: 0 Unlike traditional manual SQL query methods, the present application realizes the automatic conversion of natural language queries to standardized SQL by combining advanced natural language processing techniques and deep learning models. This method not only greatly improves query efficiency and accuracy, but is particularly suitable for non-technical personnel to query complex drilling data. By optimizing user experience, it meets the high demand for fast data retrieval and real-time decision support in drilling sites, marking a revolution in drilling data query technology.
[0019] 1 By introducing the customized "Zhongfa-7b-chat-1m" model and "Zhongfa-Coder-32B-Instruct" model, the present application improves query accuracy while simplifying the operation process, especially suitable for fast data retrieval and real-time decision support in offshore drilling sites.
[0020] 2 The "Zhongfa-7b-chat-1m" model can accurately identify table name information in user queries and automatically analyze user query intentions by fine-tuning on drilling domain-specific corpus. Compared with traditional models, this model significantly improves the accuracy of table name recognition during SQL generation, ensuring correct understanding of query intentions, thereby laying a solid foundation for subsequent SQL generation.
[0021] 4 In the SQL generation phase, the "Zhongfa-Coder-32B-Instruct" model generates SQL query statements that meet semantic logic by integrating user query intentions and database table structure information. This model, fine-tuned on drilling industry data, can meet the personalized needs of business personnel and ensure that the generated SQL queries meet the query requirements, avoiding common syntax errors and query deviations in traditional methods.
[0022] 5 According to the results of semantic understanding, the system automatically compares with the metadata in the structured database to identify the relevant database tables and fields related to the query intention. Through this step, the system can ensure the accuracy of the query and avoid query errors or data omissions.
[0023] 6 The results are formatted for output. Supports various data display formats such as tables and graphs to ensure that users can intuitively understand the query results; in addition, it can intelligently complete the fields, providing a convenient, efficient and accurate solution for complex drilling data queries. BRIEF DESCRIPTION OF DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.
[0025] Figure 1 The existing technology and the technical solutions of the present application are compared with the schematic diagram.
[0026] Figure 2 The flow chart of the drilling completion report adaptive SQL generation and intelligent question and answer data processing method of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments.
[0028] As Figure 2 shown, a drilling completion report adaptive SQL generation and intelligent question and answer data processing method comprises: S1. receiving a user natural language query input; The query request input by the user through the natural language is received and subsequent processing is performed. If the table name or other necessary information is missing in the user query input, the user is guided to supplement or select the related table name to ensure the completeness of the query.
[0029] S2. sending the query input into a "Zhongfa-7b-chat-1m" model to understand the query intention, identifying and outputting the table name in the user query input, the "Zhongfa-7b-chat-1m" model being generated after the "internlm2_5-7b-chat-1m" model is fine-tuned by SFT; The natural language query of the user is input into the "Zhongfa-7b-chat-1m" model fine-tuned by SFT, the model performs semantic understanding on the query sentence, and identifies the intention, table name and key field of the query. The input of the model is the user query , and the output is the predicted table name: The "Zhongfa-7b-chat-1m" model has been fine-tuned on drilling field data, and has strong intention recognition and table name extraction capabilities.
[0030] S3. According to the table name output by the model, access the structured database metadata to obtain the structure information corresponding to the table, including field name and data type; the structured database is a structured drilling industry database constructed based on PostgreSQL; The structured database is a structured drilling industry database constructed based on PostgreSQL. The system accesses the structured database metadata through the configured data source connection mode, and uses the standard INFORMATION_SCHEMA.COLUMNS view or pg_catalog system table provided by PostgreSQL to obtain the data structure information corresponding to the table name.
[0031] According to the result of semantic understanding, the metadata in the structured database is automatically compared and matched to identify the database table and field related to the query intention. Through this step, the accuracy of the query can be ensured, and query errors or data omissions can be avoided.
[0032] Embodiment 1: (1) Input the query statement: for example, "query the top depth and horizon of BZ13-1S-3d well".
[0033] (2) The model identifies the table name mentioned in the query according to the fine-tuning process, such as "GEO_OilGasO".
[0034] (3) After identifying the table name, the system accesses the structured database metadata to obtain the structure information of the table, including field name, data type, constraint condition, etc.
[0035] S4. Input the natural language query and the obtained table structure information into the "Zhongfa-Coder-32B-Instruct" model to generate a SQL query statement that meets the semantic logic; the "Zhongfa-Coder-32B-Instruct" model is generated by fine-tuning the "Qwen2.5-Coder-32B-Instruct" model; Input the natural language query and the database table structure information into the fine-tuned "Zhongfa-Coder-32B-Instruct" model to generate a preliminary SQL query statement. This process can be expressed as: The generated SQL query statement is modeled in the form of semantic triples as: , where is the table name, is the field set, is the constraint condition, and the standard SQL query statement is in the form of: .
[0036] The "China-France Coder-32B-Instruct" model supports complex conditions, field mapping and multi-table connection, and ensures complete expression of query semantics.
[0037] Embodiment 2: For example, the query "Query the top depth and horizon of BZ13-1S-3d well" is converted into: SELECT Well_NO, FORMA_ID, Top_Depth FROM GEO_OilGasO WHERE Well_NO = 'TEST_WELL_NO'; The finally generated SQL query statement will be sent to the structured database for execution to obtain the structured query result.
[0038] S5. Execute the generated SQL query statement and return the structured query result, which includes tables and graphs.
[0039] All query results are displayed in a structured format for easy reading and analysis by users. For example, the generated SQL query statement is passed to the structured database engine, and a structured table is generated according to the execution result wherein is the number of records, is the number of fields.
[0040] Further, the method further comprises: S6. Determine whether the query result is missing a field related to the query semantics, and if so, complete the query result and format the output to generate a standardized query report; or the step S4 of generating a SQL query statement that meets the semantic logic further comprises: determining whether the generated SQL query statement is missing a field related to the query semantics, and if so, automatically completing the missing field according to the structured database table structure and semantic reasoning to ensure the completeness of the query result and the accuracy of the expression.
[0041] During SQL generation, an automatic optimization rewriting mechanism is included. The optimization rewriting mainly includes field completion, i.e., when the generated SQL query statement is missing a field related to the query semantics, the missing field can be automatically completed according to the structured database table structure and semantic reasoning to ensure the completeness of the query result and the accuracy of the expression.
[0042] Further, after receiving the user natural language query input in step S1, it includes determining whether the natural language input includes a table name, and if not, generating a guide mechanism to guide the user to input the table name.
[0043] Further, the accuracy of the table name matching in step S2 is defined as: wherein, represents the number of correct table name recognition problems, represents the total number of problems tested.
[0044] Further, the generation method of the “Chinese-French-7b-chat-1m” model in step S2 is specifically: S2.1: Construct a fine-tuning data set for the “internlm2_5-7b-chat-1m” model based on the commonly used databases in the drilling industry, which includes drilling industry-specific terminology and expression methods; S2.2: Construct a first training data set based on the fine-tuning data set, which includes a large number of natural language query inputs and their corresponding table name labels; S2.3: Train the “internlm2_5-7b-chat-1m” model using the first training data set to obtain the “Chinese-French-7b-chat-1m” model.
[0045] During training, the “internlm2_5-7b-chat-1m” model learns how to extract table name information from natural language queries.
[0046] The key to model fine-tuning lies in the selection and preparation of data. In order to improve the precision and field adaptability of the model, the fine-tuning data comes from the commonly used databases in the drilling industry. The commonly used databases in the drilling industry usually record professional field corpus such as drilling engineering terminology, completion process flow and standard structured report forms. The “internlm2_5-7b-chat-1m” model is selected as an intent recognition model to identify the corresponding database table name information from the user's natural language query. By fine-tuning the model, it can handle drilling industry-specific terminology and expression methods, so as to accurately extract table names in complex queries.
[0047] Further, the generation method of the “Chinese-French-Coder-32B-Instruct” model in step S4 is specifically: S4.1: Construct a fine-tuning data set for the “Qwen2.5-Coder-32B-Instruct” model based on the commonly used databases in the drilling industry, which includes drilling industry-specific terminology and expression methods; S4.2: Construct a second training data set based on the fine-tuning data set, which includes a large number of natural language query inputs and corresponding standardized SQL query statements, and corresponding table structure information; S4.3: Train the "Qwen2.5-Coder-32B-Instruct" model using the second training dataset to obtain a "Chinese-French-Coder-32B-Instruct" model.
[0048] During the training process, the model learns how to match user queries with database table structures and generate semantically correct SQL queries by learning from the data in the second training dataset.
[0049] The "Qwen2.5-Coder-32B-Instruct" model serves as a SQL generation model, responsible for generating standardized SQL query statements based on user query intentions. Through fine-tuning, it can handle multi-table associations, field mappings, and complex query conditions, ensuring that the generated SQL query statements meet user query requirements.
[0050] Compared to traditional methods that rely on a single large language model to directly generate SQL queries, the present application uses a customized "Chinese-French-7b-chat-1m" intent recognition model to accurately identify table name information in queries, and combines it with a fine-tuned "Chinese-French-Coder-32B-Instruct" model to generate SQL query statements that meet semantic logic. This method addresses the low accuracy of traditional SQL queries (usually less than 70%) and significantly improves query accuracy, with an accuracy rate of over 95%, meeting the needs of enterprise-level applications, especially for data retrieval and real-time decision support in offshore drilling sites.
[0051] Further, the method of accessing structured database metadata in step S3 includes connecting to a PostgreSQL database through configured data source information, which includes necessary parameters such as database type, connection address, port number, database name, authentication information, etc. After identifying the structured database table name (such as "GEO_OilGasO" output in step S2), the system accesses the structured database through the information schema (INFORMATION_SCHEMA.COLUMNS) provided by PostgreSQL or the equivalent pg_catalog metadata interface to obtain the field definition information of the corresponding data table, including field name, data type, field annotation, and constraint conditions, etc.
[0052] Further, before accessing the structured database metadata according to the table name output by the model in step S3, the method further comprises: dynamically sensing whether there is a newly added table or field in the structured database, and if so, automatically updating the structured database to add the newly added table or field; and then preloading the updated structured database metadata.
[0053] Further, the SQL query statement in step S4 can be abstracted as a semantic triple , wherein is a table name, is a field set, is a constraint condition, and the standard SQL query statement is in the form of: .
[0054] Further, the method further comprises: S7: performing post-processing operations on the query results, including sorting, filtering, aggregation, grouping statistics, and perspective analysis, to meet the diversified analysis needs of users.
[0055] Embodiment 3: 1: receiving user query input The user wants to query the horizon, top depth, etc. of a certain drilling project, and inputs the natural language query as: “Help me query the horizon and top depth of the 10 table of the TEST_WELL_NO well, and sort by well name and depth”. After receiving the query request, the system delivers it to the semantic understanding module. If the query is missing a table name or other key information, the system will guide the user to supplement the required information, for example, prompting: “Your question needs to include at least one of the following table names”. This guidance mechanism can ensure that the natural language query has a complete structure.
[0056] 2: semantic understanding and field identification The user's input question is delivered to the SFT fine-tuned “Chinese-French-7b-chat-1m” model for semantic analysis. The model identifies that the intent is “querying drilling data”, the table name candidate is GEO_OilGasO, and the key fields include “horizon (FORMA_ID)” and “top depth (Top_Depth)”. This semantic structure can be formally represented as: , wherein:
[0057] T: target data table name, GEO_OilGasO F: field set, such as horizon, top depth, etc. C: query constraint condition, such as well name, sorting requirement, etc. If the user does not specify the table name, the model will infer the candidate table based on the context, or return a selectable list for the user to choose from.
[0058] 3: matching database table structure Based on the identified query intent and key fields, the system compares them with metadata in the structured database, automatically matching the appropriate structured database table structure and fields. By analyzing the query intent, the system determines the required data table (e.g., "Table 10") and identifies relevant fields within the table (e.g., "Well Name," "Layer," "Top Depth," and "Depth"). This process ensures that the system correctly accesses tables and fields relevant to the query, thereby improving query accuracy.
[0059] Among them, the corresponding structural information of Table 10 is: { "tableId":"7", "tableName":"GEO_OilGasO", "tableNameCN":"10_ Mud logging oil and gas display comprehensive table", "columns": [ "Well name", "Top depth", "Bottom depth", "Horizon", "Lite type", "Drilling time", "Oil production", "Core fluorescence level", "Cuts fluorescence level", "Wall core fluorescence level", "Slot surface display", "Gas measurement total quantity", "methane", "ethane", "propane", "isobutane", "n-butane", "Isopentane", "N-pentane", "Carbon dioxide", "Other non-hydrocarbons", "Drilling fluid density", "Drilling fluid viscosity", "QFT", "Interpretation conclusion", "Remarks" ] } 4: Generate preliminary SQL query statements The natural language question and table structure information are input into the "Sino-French-Coder-32B-Instruct" model, which generates standardized SQL query statements. The process is modeled as follows: Example output: SELECTWell_NO,FORMA_ID, Top_DepthFROMgeo_oil_gas_slowWHEREWell_NO='TEST_WELL_NO'ORDERBYWell_NO, Top_Depth This process ensures the standardization and accuracy of SQL query statements and ensures that the data users query comes from the correct tables and fields.
[0060] 5: Execute SQL query and return results The generated SQL is sent to the database engine for execution, returning the structured query results, represented as wherein: : number of record rows : initial number of fields The example results are as follows: 6. Auto-completion of query fields and formatting of output If key fields such as "Well_NO" are missing in the returned results, the system will automatically complete the missing fields based on the context and adjust the order or alias. At the same time, the results are standardized and formatted for output. The final output result is defined as:
[0061] wherein: : final completed and optimized query results : there may be more columns after completing the fields
[0062] The example final results are as follows: The query results are formatted into standardized tables for users to view and analyze. Ultimately, users can see the sorted query results in the interface and can preview or download the data as needed.
[0063] The technology of the present application builds an intelligent semantic analysis system based on large language models (LLM), combining natural language recognition, query intent extraction, NL2SQL conversion, database structure perception, and other technologies, which can automatically convert natural language questions proposed by users into standardized SQL queries, and support format adaptation and intelligent query functions of query results.
[0064] Not only can it efficiently handle natural language queries from non-technical personnel, but it can also intelligently complete fields and format query results, providing a convenient, efficient, and accurate solution for complex drilling data queries.
[0065] The technical solution of the present application is not limited to a specific drilling data query model or database structure. Although the embodiments mainly describe the application of the technical solution in marine drilling and completion data queries, any person skilled in the relevant art can make appropriate modifications or changes based on the present application without departing from the essence and scope of the technical solution of the present application.
[0066] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A drilling and completion report adaptive SQL generation and intelligent question-answering data processing method, characterized in that: include: S1. Receive user natural language query input; S2. The query input is fed into the "Zhongfa-7b-chat-1m" model, which understands the query intent, identifies and outputs the table name in the query input. The "Zhongfa-7b-chat-1m" model is generated by fine-tuning the "internlm2_5-7b-chat-1m" model using SFT. S3. Based on the table name output by the model, access the structured database metadata to obtain the table's corresponding structural information, including field names and data types. The structured database is a structured drilling industry database built based on PostgreSQL; S4. The natural language query input and the obtained table structure information are input together into the "Chinese-Coder-32B-Instruct" model, which generates a SQL query statement that conforms to the semantic logic; the "Chinese-Coder-32B-Instruct" model is "Qwen2.5-Coder-32B-Instruct" model generated after fine-tuning the SFT; S5. Execute the generated SQL query statement and return a structured query result, which includes a table and a graph.
2. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The method further comprises: S6. Determine whether the query results are missing fields related to the query semantics; if so, complete and format the query results to generate a standardized query report; or, after generating the SQL query statement that conforms to the semantic logic in step S4, further include: determining whether the generated SQL query statement is missing fields related to the query semantics; if so, automatically complete the missing fields based on the structured database table structure and semantic reasoning to ensure the completeness of the query results and the accuracy of the expression.
3. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: After receiving the user's natural language query input in step S1, the method includes: determining whether the natural language input includes a table name; if not, generating a guidance mechanism to guide the user to input a table name.
4. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The accuracy of the table name matching in step S2 is defined as: in, Indicates the number of questions where the table name is correctly identified. Indicates the total number of questions in the test.
5. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The method for generating the "Chinese-French-7b-chat-1m" model in step S2 is specifically: S2.1: Construct a fine-tuning dataset for the "internlm2_5-7b-chat-1m" model based on a commonly used database in the drilling industry, which includes drilling-specific terminology and expressions. S2.2: Construct a first training dataset based on the fine-tuning dataset, where the first training dataset includes a large number of natural language query inputs and their corresponding table name labels; S2.3: Use the first training data set to train the "internlm2_5-7b-chat-1m" model to obtain the "Chinese-French-7b-chat-1m" model.
6. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The method for generating the "Chinese-French-Coder-32B-Instruct" model in step S4 is specifically: S4.1: Construct a fine-tuning dataset for the "Qwen2.5-Coder-32B-Instruct" model based on a commonly used database in the drilling industry, which includes drilling-specific terminology and expressions; S4.2: Constructing a second training dataset based on the fine-tuning dataset, where the second training dataset includes a large number of natural language query inputs and corresponding standardized SQL query statements, as well as corresponding table structure information; S4.3: Use the second training data set to train the "Qwen2.5-Coder-32B-Instruct" model to obtain the "Sino-French-Coder-32B-Instruct" model.
7. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The method for accessing the structured database metadata in step S3 includes: connecting to the structured database through the configured data source information, and obtaining table field definitions, including field names, data types, field comments, and constraints, through the information schema INFORMATION_SCHEMA.COLUMNS provided by PostgreSQL or the equivalent pg_catalog metadata interface; the data source information includes the structured database type, connection address, port number, structured database name, and authentication information.
8. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: In step S3, before accessing the structured database metadata based on the table name output by the model, the method further includes: dynamically sensing whether there is a new table or field in the structured database; if so, automatically updating the structured database to add the new table or field; and then preloading the updated structured database metadata.
9. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 1, characterized in that: The SQL query statement in step S4 can be abstracted into a semantic triple ,in is the table name, For the field collection, As a constraint condition, the standard SQL query statement is in the form of: .
10. The method for adaptive SQL generation and intelligent question-answering data processing of drilling and completion reports according to claim 2, characterized in that: The method further comprises: S7: Perform post-processing operations on the query results, including sorting, filtering, aggregation, group statistics, and perspective analysis to meet users' diverse analysis needs.
Citation Information
Cited By
Multi-agent data query method and device, electronic equipment and storage medium
CN121434260A
Structured query statement generation method and device, medium, equipment and product
CN121658505A
Text-to-structured query language method and system for metal mine scene
CN122547821A