Navigation equipment data analysis method and device based on large language model and intelligent agent
By building intelligent agent and large language model modules, the problem of large language models being unable to directly access structured datasets was solved, achieving accurate conversion of natural language to SQL and data analysis, reducing development costs, and improving query efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE NAVIGATION GUARANTEE CENT OF NORTH CHINA SEA NGCN MOT
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-05
AI Technical Summary
In existing technologies, large language models cannot directly access large amounts of structured datasets, cannot accurately convert natural language into SQL, and traditional data statistics systems have long development cycles and high costs, are cumbersome for users, and are difficult to meet the needs for convenience.
By building an intelligent agent, two large language model modules are introduced to convert natural language to SQL and perform data analysis. Combined with the MCP service program, data interaction, chart generation and output are realized.
It achieves accurate conversion from natural language to SQL, reduces development and usage costs, improves query efficiency and user experience, and ensures the security and stability of data interaction.
Smart Images

Figure CN121979909A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database interaction and visualization report generation technology driven by large language models, specifically to a method and device for analyzing nautical equipment data based on large language models and intelligent agents. Background Technology
[0002] Maritime safety supplies and equipment are various materials and equipment provided to ensure the safe navigation of ships, respond to emergencies, and complete specific tasks. They play an irreplaceable role in the maritime safety assurance system. The data classification system for this type of equipment is extremely complex, covering multiple major categories such as navigation marks and their accessories, lights, and radio equipment. Each major category is further subdivided into various subcategories, forming a rich and massive data set.
[0003] In maritime safety operations, accurate statistical analysis of such equipment data is a crucial prerequisite for formulating support plans, optimizing resource allocation, and responding to emergencies. After preliminary data preprocessing, relevant units will generate a standardized dataset containing nearly 3,000 data points. However, under current technological conditions, the utilization of this dataset faces numerous challenges. Firstly, directly relying on large language models to process this dataset has significant limitations. Large language models are essentially probability-based text generators, primarily tasked with predicting the next possible word or character, rather than dedicated calculators or data analysis engines. Due to their lack of knowledge about maritime safety operations and their inherent computational limitations, they can only describe report content and cannot accurately calculate statistical results, leading to data query and statistical accuracy that fails to meet practical needs. Furthermore, large language models cannot directly access large structured datasets, making it difficult to obtain a stable and secure processing platform for this dataset. Secondly, traditional data statistical analysis methods suffer from efficiency and cost issues. In existing technologies, B / S architecture is often used to build dedicated data systems to process data on maritime support equipment. The development cycle of such systems is usually as long as one month, which not only consumes a lot of time costs, but also requires investment in cooperation with the contractor, resulting in high overall costs.
[0004] Furthermore, users' demands for convenient data retrieval are increasing. Traditional systems require users to input query conditions through a specific interface, resulting in cumbersome procedures and failing to meet the needs of users who wish to directly obtain accurate data using natural language. Therefore, overcoming existing technological bottlenecks to achieve interaction between natural language and structured data, accurately and quickly completing statistical analysis of maritime support equipment data, and reducing development and usage costs have become urgent technical challenges. Summary of the Invention
[0005] To address these issues, this invention provides a method and apparatus for analyzing nautical equipment data based on a large language model and intelligent agents. This addresses the problems in existing technologies where large language models are probabilistic text generators and non-professional data analysis engines, unable to directly access large amounts of structured datasets, difficult to accurately convert natural language into SQL, lacking compatible SQL transmission and data return program services, and traditional data statistics systems suffer from long development cycles and high costs.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for analyzing nautical equipment data based on a large language model and intelligent agents, comprising the following steps: S1. Build intelligent agents based on the large model management platform; S2. Receive natural language commands from the user to query maritime support equipment data through the intelligent agent; S3. Introduce the first large language model module, and use the first large language model module to convert the natural language instructions into executable SQL statements, and perform syntax correctness verification on the SQL statements; S4. Through the MCP service program that interacts with the database, the verified SQL statement is transmitted to the database and the query is executed to obtain the navigation support equipment dataset. S5. Introduce the second major language model module, and use the second major language model module to organize the data set of the maritime support equipment and generate a data report; S6. Using the chart generation class MCP service program embedded in the second major language model module, select appropriate charts for display based on the characteristics of the maritime support equipment dataset; S7. Output the data report and corresponding charts.
[0007] As a preferred scheme for a nautical equipment data analysis method based on a large language model and intelligent agents, S3 pre-sets the role of the first large language model module, sets the first large language model module as an SQL generator, and informs the first large language model module of the database table structure to be accessed and the Chinese meaning of each field in the prompt word column.
[0008] As a preferred scheme for a method of analyzing nautical equipment data based on a large language model and intelligent agents, S3 inputs commonly used example SQL statements for querying nautical support equipment data into the first large language model module, allowing the first large language model module to refer to the examples before generating the SQL statements.
[0009] As a preferred scheme for a nautical equipment data analysis method based on a large language model and intelligent agents, in S3, the first large language model module identifies the specific query conditions in the natural language command by the Chinese meaning of the fields in the prompt words, establishes a correspondence between the query conditions and the corresponding fields in the database, and generates an initial SQL statement by combining the syntax rules of the example SQL statement.
[0010] As a preferred scheme for a nautical equipment data analysis method based on a large language model and intelligent agents, if the initial SQL statement syntax check fails in S3, the first large language model module is triggered to regenerate the SQL statement and check it again until a syntactically correct executable SQL statement is generated.
[0011] As a preferred solution for a nautical equipment data analysis method based on a large language model and intelligent agents, the MCP service program in S4 is developed based on Python, with an open interface. After the MCP service is started, it can be called by inputting the IP address and port.
[0012] As a preferred scheme for a nautical equipment data analysis method based on a large language model and intelligent agent, the MCP service program in S4 receives the SQL statement, uses the SQL statement as a parameter to call the interface function to execute the SQL, connects to the database and executes the query, and returns the query result in JSON format; The database and the MCP service program are deployed on a CentOS 8 virtual machine system.
[0013] As a preferred scheme for a navigation equipment data analysis method based on a large language model and intelligent agents, S5 pre-sets the role of the second large language model module, setting it as a data report analyst, and informing the second large language model module of the table structure in the database in the prompt words.
[0014] As a preferred scheme for a navigation equipment data analysis method based on a large language model and intelligent agents, the database is a relational database MySQL, and the navigation support equipment data stored in the database is standardized navigation support equipment data from the North China Sea Navigation Support Center, the East China Sea Navigation Support Center, and the South China Sea Navigation Support Center; The data on maritime support equipment, after being standardized and organized, is stored in a structured database table named "Maritime Support Materials and Equipment Table". The fields of the database table include superior unit, unit, category, subcategory, specifications, manufacturer, quantity, and remarks.
[0015] This invention also provides a navigation equipment data analysis device based on a large language model and intelligent agent, employing the aforementioned navigation equipment data analysis method based on a large language model and intelligent agent, comprising: Intelligent agent building unit: used to build intelligent agents based on the large model management platform; Query command receiving unit: used to receive natural language commands initiated by the user to query maritime support equipment data through the intelligent agent; First processing unit: used to introduce the first large language model module, convert the natural language instructions into executable SQL statements through the first large language model module, and perform syntax correctness verification on the SQL statements; Data set acquisition unit: used to transmit the verified SQL statement to the database and execute the query through the MCP service program that interacts with the database, and obtain the navigation support equipment dataset; The second processing unit is used to introduce the second major language model module, and to organize the maritime support equipment dataset through the second major language model module to generate a data report; Chart generation and display unit: used to select appropriate charts for display based on the characteristics of the maritime support equipment dataset by means of a chart generation class MCP service program embedded in the second major language model module; Query result output unit: used to output the data report and corresponding charts.
[0016] The present invention has the following advantages: First, this invention achieves accurate conversion of natural language to SQL through role preset, prompt word configuration (table structure, field meaning, instance SQL) and syntax verification mechanism of large language model module 1; at the same time, it collects auxiliary information such as historical chat records, current time, and dialogue ID to help the model understand the user's contextual needs. This not only solves the pain point that large language models cannot accurately process structured data statistics, but also improves the coherence and accuracy of multi-turn interactions.
[0017] Secondly, users of this invention do not need to master SQL syntax or professional operation skills. They can initiate data query requests simply through natural language. The intelligent agent automatically completes the entire process of SQL generation, data query, report organization, and chart generation, which lowers the threshold for data use and improves query efficiency.
[0018] Third, this invention relies on the MaxKB platform to build intelligent agents, and the development cycle only takes one week, which is significantly shorter than the one-month development cycle of traditional B / S architecture data systems; it does not require a large investment in cooperation with other companies, which significantly saves financial costs and reduces the difficulty of system maintenance.
[0019] Fourth, the chart generation MCP service program of this invention is embedded in the second major language model module. It can automatically match the appropriate chart type (such as bar chart, line chart, etc.) according to the characteristics of the dataset, transform structured data into visual charts, and output them in sync with the data report, making the data results easier to understand and analyze.
[0020] Fifth, the database and MCP service program of this invention are deployed on a CentOS 8 system virtual machine, which has the characteristics of enhanced isolation, easy backup and easy migration, ensuring the security and stability of data storage and interaction; based on modular design, fields and model functions can be flexibly expanded or adapted to more maritime support business scenarios according to business needs. Attached Figure Description
[0021] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0022] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0023] Figure 1 This is a schematic diagram of a method for analyzing nautical equipment data based on a large language model and intelligent agents, provided in an embodiment of the present invention. Figure 2 This is a technical architecture diagram of a nautical equipment data analysis method based on a large language model and intelligent agents provided in an embodiment of the present invention; Figure 3 This is a design pattern diagram of a nautical equipment data analysis method based on a large language model and intelligent agent provided in an embodiment of the present invention; Figure 4 This is a diagram illustrating the effect of building an intelligent agent for a method of analyzing nautical equipment data based on a large language model and intelligent agents, as provided in an embodiment of the present invention. Figure 5 This is a schematic diagram of the architecture of a nautical equipment data analysis device based on a large language model and intelligent agent provided in an embodiment of the present invention. Detailed Implementation
[0024] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Example
[0025] See Figure 1 , Figure 2 and Figure 3 This invention provides a method for analyzing nautical equipment data based on a large language model and intelligent agents, comprising the following steps: S1. Build intelligent agents based on the large model management platform; Specifically, intelligent agents are built using existing large-scale model management platforms (such as the MaxKB platform). This leverages the platform's mature module integration and scheduling capabilities, avoiding the need to develop an architecture from scratch and reducing development complexity. As a unified carrier, the intelligent agent enables collaborative operation of components such as the large language model module, MCP service program, and database, providing a stable operating framework for subsequent end-to-end data processing and ensuring smooth data flow at each stage.
[0026] S2. Receive natural language commands from the user to query maritime support equipment data through the intelligent agent; Specifically, receiving natural language commands is designed to meet users' needs for convenient operation, eliminating the need for users to master SQL syntax or professional operating procedures. This step serves as the input entry point for data processing, requiring accurate capture of the user's main query requirements (such as "query buoy data from the Tianjin Navigation Mark Office"), and the complete transmission of the command to the next processing module, laying the foundation for subsequent SQL conversion and data querying.
[0027] S3. Introduce the first large language model module, and use the first large language model module to convert the natural language instructions into executable SQL statements, and perform syntax correctness verification on the SQL statements; Specifically, the large language model module 1 serves as the main bridge between natural language and database queries. Since databases can only recognize SQL statements, this module is needed to convert unstructured natural language into structured SQL commands. The syntax validation step is to avoid the problem of SQL statements generated by the model failing to execute due to syntax errors, ensuring that the query commands passed to the database conform to execution specifications, reducing invalid interactions, and improving query efficiency.
[0028] S4. Through the MCP service program that interacts with the database, the verified SQL statement is transmitted to the database and the query is executed to obtain the navigation support equipment dataset. Specifically, the MCP service program acts as "middleware," addressing the technical challenge of large language models being unable to directly access the database. Its main function is to establish a communication connection between the large language model module 1 and the database, securely and accurately transmit validated SQL statements to the database, and receive query results returned by the database, achieving bidirectional data transmission and ensuring a closed-loop query process.
[0029] S5. Introduce the second major language model module, and use the second major language model module to organize the data set of the maritime support equipment and generate a data report; Specifically, the dataset returned by the database is raw structured data, which is difficult for users to understand directly. The Large Language Model Module 2 transforms the raw data into a clear and readable data report through data processing, logical analysis, and information extraction. At the same time, it combines the database table structure provided in the prompts to ensure that the report content accurately corresponds to the meaning of the data, thus meeting the user's needs for data interpretation.
[0030] S6. Using the chart generation class MCP service program embedded in the second major language model module, select appropriate charts for display based on the characteristics of the maritime support equipment dataset; Specifically, charts and graphs serve as a visual supplement to data reports. Compared to plain text reports, charts and graphs can more intuitively present key information such as data distribution and quantitative relationships. This MCP service program is embedded in the Large Language Model Module 2, which can simultaneously analyze dataset characteristics (such as category distribution, quantity comparison, etc.) during data processing and automatically match appropriate chart types (bar charts, pie charts, etc.) to enhance the intuitiveness and aesthetics of data presentation.
[0031] S7. Output the data report and corresponding charts.
[0032] Specifically, the output step involves providing the user with the final processed results, completing the entire process from querying the request, processing the data, to receiving the results. Data reports and charts are output simultaneously, satisfying users' need for detailed data information while providing intuitive visualizations to adapt to different usage scenarios and enhance the user experience.
[0033] In one possible embodiment, in S3, the role of the large language model module 1 is pre-set, the large language model module 1 is set as an SQL generator, and the prompt word column informs the large language model module 1 of the database table structure to be accessed, as well as the Chinese meaning of each field.
[0034] Specifically, the role pre-setting clearly defines the main tasks of the large language model module 1, preventing the model from deviating from its functional positioning and focusing on the conversion from natural language to SQL. The prompts inform the model of the table structure and the Chinese meaning of the fields, so as to help the model understand the data storage logic, establish the mapping relationship between natural language and database fields, solve the conversion deviation problem caused by the model's lack of understanding of the business data structure, and improve the accuracy of SQL generation.
[0035] In one possible embodiment, in S3, commonly used example SQL statements for querying maritime support equipment data are input to the large language model module 1, allowing the large language model module 1 to refer to the examples before generating the SQL statements.
[0036] Specifically, the example SQL statements provide the model with transformation references for specific scenarios, clarifying the syntax rules, field matching methods, and other details of data querying for maritime support equipment. By learning the transformation logic of the examples, the model can quickly adapt to specific business scenarios, reduce transformation errors caused by insufficient model generalization ability, and further improve the accuracy and adaptability of SQL generation.
[0037] In one possible embodiment, the large language model module 1 in S3 identifies the specific query conditions in the natural language instruction by the Chinese meaning of the fields in the prompt words, establishes a correspondence between the query conditions and the corresponding fields in the database, and generates an initial SQL statement by combining the syntax rules of the example SQL statement.
[0038] Specifically, this embodiment clarifies the main logical flow of SQL generation. First, it achieves precise mapping between query conditions and database fields by using the Chinese meanings of the fields (e.g., "Tianjin Navigation Mark Office" corresponds to the "unit" field, and "buoy" corresponds to the "category" field). Then, it combines the syntax rules of the example SQL to organize the statement structure, ensuring that the generated initial SQL statement not only conforms to the syntax rules but also accurately matches the user's query requirements, thus guaranteeing the correctness of the query results from the source.
[0039] In one possible embodiment, if the initial SQL statement syntax check fails in S3, the large language model module 1 is triggered to regenerate the SQL statement and check it again until a syntactically correct executable SQL statement is generated.
[0040] Specifically, syntax validation is the error-tolerance mechanism for SQL generation. Since large language models may produce SQL with syntax errors due to probabilistic generation characteristics, a loop logic of validation, regeneration, and re-validation can filter invalid statements, ensuring that the SQL instructions finally passed to the database fully comply with the execution specifications. This avoids query failures due to syntax errors and improves the stability and reliability of the system.
[0041] In one possible embodiment, the MCP service program in S4 is developed based on Python, has an exposed interface, and can be invoked by inputting the IP address and port number after the MCP service is started.
[0042] Specifically, Python has the advantages of high development efficiency and strong database adaptability, making it suitable for developing lightweight data interaction services. The external interface provides a call entry point for the large language model module 1, and the call method using IP and port is the standard call method for network services, which is universal and convenient, ensuring that the large language model module 1 can quickly and stably connect to and call the MCP service program.
[0043] In one possible embodiment, after receiving the SQL statement, the MCP service program in S4 calls the interface function that executes SQL with the SQL statement as a parameter, connects to the database and executes the query, and returns the query result in JSON format. The database and the MCP service program are deployed on a CentOS 8 virtual machine system.
[0044] Specifically, calling the interface function to execute SQL is the main action for the MCP service program to interact with the database. This function passes the SQL statement to the database and triggers the query. The JSON format is lightweight, easy to parse, and cross-platform compatible, which facilitates the large language model module 2 to quickly process the returned data. Deploying the database and the MCP service program in a CentOS 8 system virtual machine can enhance the isolation between the service and the external environment. At the same time, the virtual machine's easy backup and migration features ensure the security and flexibility of data storage and service operation.
[0045] In one possible embodiment, in S5, the role of the large language model module 2 is pre-set, the large language model module 2 is set as a data report analyst, and the table structure in the database is informed to the large language model module 2 in the prompt word.
[0046] Specifically, the pre-defined roles allow the Large Language Model Module 2 to focus on data organization and report generation tasks, avoiding functional generalization; the prompts inform the table structure, helping Module 2 understand the meaning of the fields in the returned dataset and the data relationship logic, ensuring that it can accurately interpret data information when organizing data, generate professional data reports that conform to business scenarios, and avoid report errors caused by misunderstandings of fields.
[0047] In one possible embodiment, the database is a relational database MySQL, and the navigation support equipment data stored in the database is standardized navigation support equipment data from the North China Sea Navigation Support Center, the East China Sea Navigation Support Center, and the South China Sea Navigation Support Center. The data on maritime support equipment, after being standardized and organized, is stored in a structured database table named "Maritime Support Materials and Equipment Table". The fields of the database table include superior unit, unit, category, subcategory, specifications, manufacturer, quantity, and remarks.
[0048] Specifically, MySQL, as a mature relational database, is suitable for storing highly structured and correlated maritime support equipment data, and can accurately support SQL query operations; it limits the standardized data of the three major maritime support centers, clarifies the scope of data application, and ensures data relevance; the standardized organization and structured storage of data can eliminate data redundancy and chaos, while the eight fields comprehensively cover the main attributes of maritime support equipment, which can meet various statistical analysis needs and lay the data foundation for queries.
[0049] See Figure 4 In one application of this invention, after a user inputs a natural language command to query maritime support equipment data, the command is transmitted to the "Start" node. While receiving the command, the "Start" node collects global variables such as the current time, historical chat records, and dialogue ID to provide contextual support for subsequent processing.
[0050] Next, the instructions and global variables are passed to the first language model, which is pre-defined as a professional MySQL converter. It obtains the structure of the database table `navigationMaterial` (aviation support materials and equipment table) and the Chinese meaning of each field through prompt words, converts the natural language instructions into initial SQL statements, and performs syntax validation on the initial SQL statements. If the validation fails, the model is triggered to regenerate the SQL statement until a syntactically correct executable SQL statement is generated.
[0051] The validated SQL statement is passed to the MCP service program, which acts as middleware connecting the large language model and the database. Using the configured URL and the `execute_sql` tool, the SQL statement is passed to the MySQL database for query execution. The database and the MCP service program are deployed on a CentOS 8 virtual machine. The dataset returned after the query is executed is forwarded by the MCP service program to the second large language model.
[0052] The second language model is pre-defined as a professional data analyst. Using prompts, the analyst understands the database table structure, organizes the received dataset to generate a data report, and simultaneously invokes an embedded chart generation service (MCP) to match appropriate chart types based on the dataset's characteristics. Finally, the second language model integrates the data report and visualization charts, providing feedback to the user through output nodes, incorporating the thought process, thus completing the entire workflow.
[0053] The application scenarios of this invention are as follows: Daily data query for navigation support centers: Deployed in the North China Sea, East China Sea and South China Sea navigation support centers for daily equipment inventory and data verification, this service utilizes natural language to SQL, syntax verification, and MCP service data interaction mechanisms to provide business and management personnel with accurate navigation support equipment data query results, adapting to the standardized data statistics needs of the three centers.
[0054] Maritime support emergency material dispatch: Deployed in emergency mission scenarios such as navigation mark malfunction repair and maritime emergency rescue, it provides emergency support teams with key data such as equipment inventory and specifications in the target area through natural language rapid parsing, real-time database query, and visualization chart generation mechanism, adapting to the need for rapid acquisition of emergency response data.
[0055] Optimization of maritime support resources: Deployed in decision-making scenarios such as maritime support equipment procurement planning and cross-regional resource allocation, relying on multi-dimensional SQL queries, data integration and analysis, and trend chart generation mechanisms, it provides planners and decision-makers with key information such as equipment distribution and usage status, adapting to the needs of resource optimization decision support.
[0056] Lightweight data query system deployment: Deployed in small and medium-sized units such as navigation mark management offices and business departments under the maritime bureau. With the help of the MaxKB platform, intelligent agents and low-code development mechanisms can be quickly built to rapidly implement data query services, adapting to the lightweight and low-cost data service construction needs of small and medium-sized units.
[0057] Maritime support business data review: Deployed in scenarios such as quarterly and annual maritime support equipment usage reviews and audits, it provides auditors and review teams with traceable review data through accurate historical data query, complete process traceability, and data visualization presentation mechanisms, adapting to the needs of business standardization and optimization.
[0058] It should be noted that the method of this embodiment can also be applied to distributed scenarios, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the long video question-answering enhancement processing method based on bidirectional audio-visual alignment.
[0059] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous. Example
[0060] See Figure 5 This invention also provides a navigation equipment data analysis device based on a large language model and intelligent agent, employing the aforementioned navigation equipment data analysis method based on a large language model and intelligent agent, including: Intelligent Agent Building Unit 100: Used to build intelligent agents based on the large model management platform; Query instruction receiving unit 200: used to receive natural language instructions initiated by the user for querying maritime support equipment data through the intelligent agent; First processing unit 300: used to introduce a first large language model module, convert the natural language instructions into executable SQL statements through the first large language model module, and perform syntax correctness verification on the SQL statements; Data set acquisition unit 400: Used to transmit the verified SQL statement to the database and execute the query through the MCP service program that interacts with the database, thereby acquiring the maritime support equipment dataset; The second processing unit 500 is used to introduce the second large language model module, and to organize the maritime support equipment dataset through the second large language model module to generate a data report; Chart generation and display unit 600: used to select appropriate charts for display based on the characteristics of the maritime support equipment dataset by means of a chart generation class MCP service program embedded in the second major language model module; Query result output unit 700: used to output the data report and corresponding charts. It should be noted that the information interaction and execution process between the modules of the above-mentioned device are based on the same concept as the method embodiment in Embodiment 1 of this application, and the resulting technical effects are the same as those in the method embodiment of this application. For details, please refer to the description in the method embodiment shown above in this application, and it will not be repeated here. Example
[0061] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium storing program code for a nautical equipment data analysis method based on a large language model and an intelligent agent. The program code includes instructions for executing the nautical equipment data analysis method based on a large language model and an intelligent agent as described in Embodiment 1 or any possible implementation thereof.
[0062] Computer-readable storage media can be any usable medium that a computer can access, or a data storage device such as a server or data center that integrates one or more usable media. The usable medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g.,... DVD), or semiconductor media (such as solid-state drives (SSDs) SolidStateDisk , SSD ))wait. Example
[0063] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor; The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor can call the program instructions to execute the nautical equipment data analysis method based on a large language model and intelligent agent according to Embodiment 1 or any possible implementation thereof.
[0064] Specifically, a processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. This memory can be integrated into the processor or located outside the processor and exist independently.
[0065] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable system. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another; for example, the computer instructions can be transmitted from a website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic cable, digital subscriber line) communication. DSL It can transmit data to another website, computer, server, or data center via either a wireless (e.g., infrared, wireless, microwave) method or a wireless method.
[0066] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing systems. They can be centralized on a single computing system or distributed across a network of multiple computing systems. Optionally, they can be implemented using program code executable by a computing system, thereby storing them in a storage system for execution by the computing system. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0067] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A method for analyzing nautical equipment data based on large language models and intelligent agents, characterized in that, Includes the following steps: S1. Build intelligent agents based on the large model management platform; S2. Receive natural language commands from the user to query maritime support equipment data through the intelligent agent; S3. Introduce the first large language model module, and use the first large language model module to convert the natural language instructions into executable SQL statements, and perform syntax correctness verification on the SQL statements; S4. Through the MCP service program that interacts with the database, the verified SQL statement is transmitted to the database and the query is executed to obtain the navigation support equipment dataset. S5. Introduce the second major language model module, and use the second major language model module to organize the data set of the maritime support equipment and generate a data report; S6. Using the chart generation class MCP service program embedded in the second major language model module, select appropriate charts for display based on the characteristics of the maritime support equipment dataset; S7. Output the data report and corresponding charts.
2. The method according to claim 1, characterized in that, In S3, the first large language model module is pre-defined as an SQL generator, and the prompt word column informs the first large language model module of the database table structure to be accessed, as well as the Chinese meaning of each field.
3. The method according to claim 1, characterized in that, In S3, commonly used example SQL statements for querying maritime support equipment data are input into the first large language model module, allowing the first large language model module to refer to the examples before generating the SQL statements.
4. The method according to claim 1, characterized in that, In S3, the first large language model module identifies the specific query conditions in the natural language instruction by the Chinese meaning of the fields in the prompt words, establishes a correspondence between the query conditions and the corresponding fields in the database, and generates an initial SQL statement by combining the syntax rules of the instance SQL statement.
5. The method according to claim 1, characterized in that, In S3, if the initial SQL statement syntax check fails, the first large language model module is triggered to regenerate the SQL statement and check it again until a syntactically correct executable SQL statement is generated.
6. The method according to claim 1, characterized in that, In S4, the MCP service program is developed based on Python and has an open interface. After the MCP service is started, it can be called by entering the IP address and port.
7. The method according to claim 1, characterized in that, After receiving the SQL statement, the MCP service program in S4 calls the interface function to execute the SQL statement as a parameter, connects to the database and executes the query, and returns the query result in JSON format. The database and the MCP service program are deployed on a CentOS 8 virtual machine system.
8. The method according to claim 1, characterized in that, In S5, the role of the second language model module is pre-set, setting it as a data report analyst, and the table structure in the database of the second language model module is informed in the prompt.
9. The method according to claim 1, characterized in that, The database is a relational database MySQL, and the navigation support equipment data stored in the database is standardized navigation support equipment data from the North China Sea Navigation Support Center, the East China Sea Navigation Support Center, and the South China Sea Navigation Support Center. The data on maritime support equipment, after being standardized and organized, is stored in a structured database table named "Maritime Support Materials and Equipment Table". The fields of the database table include superior unit, unit, category, subcategory, specifications, manufacturer, quantity, and remarks.
10. A nautical equipment data analysis device based on a large language model and intelligent agent, employing the nautical equipment data analysis method based on a large language model and intelligent agent as described in any one of claims 1-9, characterized in that, include: Intelligent agent building unit: used to build intelligent agents based on the large model management platform; Query command receiving unit: used to receive natural language commands initiated by the user for querying maritime support equipment data through the intelligent agent; First processing unit: used to introduce the first large language model module, convert the natural language instructions into executable SQL statements through the first large language model module, and perform syntax correctness verification on the SQL statements; Data set acquisition unit: used to transmit the verified SQL statement to the database and execute the query through the MCP service program that interacts with the database, and obtain the navigation support equipment dataset; The second processing unit is used to introduce the second major language model module, and to organize the data set of the maritime support equipment through the second major language model module to generate a data report; Chart generation and display unit: used to select appropriate charts for display based on the characteristics of the maritime support equipment dataset by means of a chart generation class MCP service program embedded in the second major language model module; Query result output unit: used to output the data report and corresponding charts.