Search

CN-121979909-A - Navigation equipment data analysis method and device based on large language model and intelligent body

CN121979909ACN 121979909 ACN121979909 ACN 121979909ACN-121979909-A

Abstract

The invention discloses a marine equipment data analysis method and device based on a large language model and an intelligent agent, and relates to the technical field of interaction between LLM and a relational database. The method aims at solving the problems that a large language model cannot directly access a large amount of structured data, and is difficult to accurately convert natural language into SQL and lack of an adaptive data interaction program. According to the method, an intelligent body is built by means of a MaxKB platform, natural language is converted into SQL through a first large language model preset as an SQL generator and checked, an MCP service program developed by Python is transmitted to a MySQL database, data are arranged through a second large language model preset as a data report analyst, and a visual result is generated by combining an embedded chart MCP service. The invention supports the accurate acquisition of the data of the navigation security equipment by the user through natural language, has short development period, low cost and visual result, and is suitable for the scenes of data inquiry, scheduling and the like of three navigation security centers.

Inventors

  • TAN LILI
  • MAO JIANFENG
  • WU JINGLONG
  • ZHANG CHAO
  • WANG YANG
  • GUO QIANG
  • SUN GUOQING
  • CHENG SHENGLI
  • SUN JIAWEI
  • WANG HAIQING
  • Qian Meixu

Assignees

  • 交通运输部北海航海保障中心天津航标处

Dates

Publication Date
20260505
Application Date
20260123

Claims (10)

  1. 1. The marine equipment data analysis method based on the large language model and the intelligent agent is characterized by comprising the following steps: S1, building an intelligent agent according to a large model management platform; s2, receiving a natural language instruction for inquiring navigation guarantee equipment data initiated by a user through the intelligent agent; S3, introducing a first large language model module, converting the natural language instruction into an executable SQL sentence through the first large language model module, and checking the grammar correctness of the SQL sentence; s4, transmitting the SQL statement passing the verification to the database through an MCP service program interacting with the database, and executing the query to obtain a navigation guarantee equipment data set; s5, introducing a second large language model module, and sorting the navigation guarantee equipment data set through the second large language model module to generate a data report; S6, generating a similar MCP service program through a chart embedded in the second large language model module, and selecting a proper chart for display according to the characteristics of the navigation guarantee equipment data set; and S7, outputting the data report and the corresponding chart.
  2. 2. The method of claim 1, wherein in S3, the role of the first large language model module is preset, the first large language model module is set as an SQL generator, and a database table structure to be accessed by the first large language model module and chinese meaning corresponding to each field are notified in a prompt word column.
  3. 3. The method of claim 1, wherein in S3, an instance SQL statement of commonly used query marine assurance equipment data is input to the first large language model module, letting the first large language model module refer to an instance prior to generating the SQL statement.
  4. 4. The method of claim 1, wherein in S3, the first large language model module identifies specific query conditions in the natural language instruction by prompting the meaning of the field in the word, establishes a correspondence between the query conditions and the corresponding fields of the database, and generates an initial SQL statement in combination with the grammar rules of the instance SQL statement.
  5. 5. The method according to claim 1, wherein in S3, if the initial SQL statement syntax check is not passed, triggering the first large language model module to regenerate the SQL statement and check again until an executable SQL statement with correct syntax is generated.
  6. 6. The method of claim 1, wherein in S4, the MCP service program invokes the MCP service by way of an input IP and port after opening the MCP service to an external open interface based on Python development.
  7. 7. The method according to claim 1, wherein after the MCP service program receives the SQL statement in S4, the SQL statement is used as a parameter to call an interface function for executing SQL, the database is connected and a query is executed, and a query result is returned in json format; The database and the MCP service program are deployed in a centos system of a virtual machine.
  8. 8. The method of claim 1, wherein in S5, the second large language model module is personally pre-set, the second large language model module is set as a data report analyst, and a table structure in a database of the second large language model module is notified in a prompt.
  9. 9. The method of claim 1, wherein the database is a relational database MySQL, and the marine security equipment data stored in the database is normalized marine security equipment data of a north marine security center, a east marine security center, and a south marine security center; the navigation guarantee equipment data are structured and stored in a database table named as a navigation guarantee material equipment table after being normalized and arranged, and the fields of the database table comprise superior units, categories, subcategories, specifications, manufacturers, numbers and remarks.
  10. 10. A marine equipment data analysis device based on a large language model and an agent, adopting a marine equipment data analysis method based on a large language model and an agent as set forth in any one of claims 1 to 9, characterized by comprising: the intelligent body construction unit is used for constructing intelligent bodies according to the large model management platform; The inquiry instruction receiving unit is used for receiving a natural language inquiry instruction of navigation guarantee equipment data initiated by a user through the intelligent agent; The first processing unit is used for introducing a first large language model module, converting the natural language instruction into an executable SQL sentence through the first large language model module, and checking the grammar correctness of the SQL sentence; the data set acquisition unit is used for transmitting the SQL statement passing the verification to the database through an MCP service program interacting with the database and executing the inquiry to acquire a navigation guarantee equipment data set; the second processing unit is used for introducing a second large language model module, and sorting the navigation guarantee equipment data set through the second large language model module to generate a data report; the chart generation display unit is used for selecting a proper chart for display according to the characteristics of the navigation guarantee equipment data set through a chart generation MCP service program embedded in the second large language model module; and the query result output unit is used for outputting the data report and the corresponding chart.

Description

Navigation equipment data analysis method and device based on large language model and intelligent body Technical Field The invention relates to the technical field of database interaction and visual report generation driven by a large language model, in particular to a marine equipment data analysis method and device based on the large language model and an intelligent body. Background The marine security material equipment is various materials and equipment which are provided for ensuring the safe navigation of ships, coping with emergencies and completing specific tasks, and has irreplaceable functions in a marine security system. The data classification system of the equipment is extremely complex and contains a plurality of large classifications of navigation marks, accessories, lamps, radio equipment and the like, and each large classification is subdivided into a plurality of sub-classifications, so that a data set with rich layers and huge quantity is formed. In the sea-going support work, the accurate statistical analysis of the equipment data is an important precondition for making a support plan, optimizing resource allocation and coping with emergency. After pre-processing of the pre-data, the relevant units form a standardized dataset containing approximately 3000 pieces of data, but under the prior art conditions, the utilization of this dataset faces many challenges. On the one hand, there are significant limitations to directly relying on large language models to process the data set. The nature of large language models is probabilistic based text generators, the primary task being to predict the next likely word or character, rather than a specialized calculator or data analysis engine. Because of the lack of knowledge of the aviation insurance business and the self calculation power characteristic, the report content can be described only, and the statistical result can not be calculated accurately, so that the accuracy of data query and statistics is difficult to meet the actual demands. Meanwhile, large language models cannot directly access a large number of structured data sets, and the data sets are difficult to obtain stable and safe processing carriers. On the other hand, the traditional data statistics analysis method has the problems of efficiency and cost. In the prior art, a special data system is built by adopting a B/S architecture to process the marine security equipment data, the development period of the system is usually as long as 1 month, a large amount of time and cost are consumed, funds are needed to be invested to be developed in cooperation with a second company, and the overall cost is high. In addition, the convenience requirements of users on data query are increasingly improved, the conventional system needs to input query conditions through a specific operation interface, the operation flow is complex, and the use scene that the users directly acquire accurate data through natural language cannot be met. Therefore, how to break through the bottleneck of the prior art, realize the interaction of natural language and structured data, accurately and rapidly complete the statistical analysis of the data of the navigation security equipment, reduce the development and use cost, and become the technical problem to be solved urgently at present. Disclosure of Invention Therefore, the invention provides a marine equipment data analysis method and device based on a large language model and an intelligent agent, which are used for solving the problems that the large language model in the prior art is a probabilistic text generator and a non-professional data analysis engine, cannot directly access a large amount of structured data sets, is difficult to accurately convert natural language into SQL, lacks adaptive SQL transmission and data return program service, and has long development period and high cost. In order to achieve the above purpose, the invention provides a marine equipment data analysis method based on a large language model and an intelligent agent, which comprises the following steps: S1, building an intelligent agent according to a large model management platform; s2, receiving a natural language instruction for inquiring navigation guarantee equipment data initiated by a user through the intelligent agent; S3, introducing a first large language model module, converting the natural language instruction into an executable SQL sentence through the first large language model module, and checking the grammar correctness of the SQL sentence; s4, transmitting the SQL statement passing the verification to the database through an MCP service program interacting with the database, and executing the query to obtain a navigation guarantee equipment data set; s5, introducing a second large language model module, and sorting the navigation guarantee equipment data set through the second large language model module to generate a data report; S6, generating a similar M