AI Agent method and system based on large language model and knowledge graph collaboration

By employing an AI Agent approach that combines large language models with knowledge graphs, the problems of information isolation and knowledge lag in complex business scenarios are solved. This approach enables efficient fusion and dynamic updating of multi-source information, improves the accuracy and adaptability of decision-making, and promotes the continuous evolution of knowledge.

CN121835863APending Publication Date: 2026-04-10SHANGHAI WENTIAN XINGCHEN TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively integrate multi-source information in complex business scenarios, leading to information isolation during decision-making, lagging knowledge updates, and an inability to adapt to rapidly changing environmental demands, thus affecting the smooth operation of the business chain.

Method used

We adopt an AI Agent approach based on the collaboration of large language models and knowledge graphs. By receiving user input, decomposing task intent, generating knowledge graph query statements, executing queries and returning structured subgraphs or triples, we perform information fusion and decision output, and extract new entity relationship triples from the execution results to update the graph.

Benefits of technology

It enables efficient reasoning and dynamic updating of multi-source information, improves the accuracy and adaptability of decision-making, ensures the consistency and scalability of knowledge, and supports intelligent applications in dynamic environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121835863A_ABST
    Figure CN121835863A_ABST
Patent Text Reader

Abstract

The invention provides an AI Agent method and system based on cooperation of a large language model and a knowledge graph, and relates to the technical field of artificial intelligence. The method comprises the steps that user input is received, task intention is understood, the user input is decomposed into a subtask sequence, an execution plan is made, and the execution plan is used for determining a knowledge graph query and tool calling sequence; generating a knowledge graph query statement, executing the knowledge graph query statement and returning to the structured sub-graph or the triple; injecting the structured sub-graph or the triple into a large language model for information fusion, reasoning and generating decision output; calling a tool executor to execute an action instruction in the decision output, wherein the tool executor interacts with an external environment and returns an execution result; and extracting a new entity relationship triple from the execution result, and injecting the triple into the knowledge graph for updating, thereby effectively improving the accuracy and adaptability of decision making.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to an AI Agent method based on the collaboration of a large language model and a knowledge graph. Background Technology

[0002] In today's era of rapid information and intelligent development, intelligent decision-making and knowledge management are particularly crucial, directly impacting an enterprise's adaptability and competitive advantage in complex environments. Research in this field not only influences business process optimization but also profoundly affects the accuracy of real-time decision-making and the formulation of long-term strategies, becoming a vital pillar driving technological progress and industrial upgrading. However, many current methods often struggle to effectively integrate multi-source information when dealing with complex business scenarios, leading to information silos in the decision-making process and hindering the formation of comprehensive judgment criteria. Furthermore, existing solutions lag behind in knowledge updates, failing to adapt to rapidly changing environmental demands, especially when cross-domain collaboration or processing dynamic data is required, often resulting in missed optimal decision-making opportunities due to insufficient information integration.

[0003] A deeper issue lies in how to achieve real-time knowledge expansion and consistency management in dynamic environments, which has become a core technological challenge in this field. Knowledge expansion refers to enriching the existing knowledge system by continuously acquiring new information, while consistency requires that new and old knowledge not conflict, ensuring the reliability of decision-making. Due to the failure to effectively address this challenge, many systems often fail to integrate new information into their existing frameworks in a timely manner, leading to the gradual obsolescence of the knowledge system. For example, in a supply chain management scenario, when sudden market changes cause fluctuations in raw material prices, if the system cannot quickly absorb this new information and adjust its procurement strategy, it will lead to inventory backlog or uncontrolled costs. Further, if the system cannot transform fragmented information into structured knowledge content after receiving user feedback or external data, it cannot provide effective support for subsequent decisions, thus affecting the smooth operation of the entire business chain. Therefore, how to achieve real-time knowledge expansion and consistency management in dynamic environments, ensuring that new information can be integrated in a timely manner and maintaining the reliability of the knowledge system, has become a critical issue that urgently needs to be addressed in the field of intelligent decision-making and knowledge management. Summary of the Invention

[0004] This invention provides an AI Agent method and system based on the collaboration of large language models and knowledge graphs, aiming to effectively improve the accuracy and adaptability of decision-making, promote the continuous evolution of knowledge, and provide strong technical support for intelligent applications in dynamic environments.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: Firstly, this paper provides an AI Agent method based on the collaboration of large language models and knowledge graphs, which mainly includes: The system receives user input and understands the task intent, decomposes the user input into a sequence of subtasks, and formulates an execution plan, which includes calling knowledge graph queries and the order of tool execution. Generate a knowledge graph query statement, execute the knowledge graph query statement and return a structured subgraph or triple; The structured subgraphs or triples are injected into the large language model for information fusion, reasoning, and decision output generation; The tool executor is invoked to execute the action instructions in the decision output, and the tool executor interacts with the external environment and returns the execution result; Extract new entity relation triples from the execution results and inject the triples into the knowledge graph for updating.

[0006] Furthermore, receiving user input and understanding task intent includes: Extract key entities and relationships from user input, and determine the task intent based on the key entities and relationships; The task intent is decomposed into a sequence of subtasks, and the execution plan includes the knowledge graph query order of the subtask sequence.

[0007] Furthermore, the generation of the knowledge graph query statement includes: The natural language problem is translated into a graph query language, which is used to specify entity paths and attribute filtering. Retrieve relevant nodes and edges using the graph query language, and return the structured subgraph or triples.

[0008] Furthermore, the step of injecting the structured subgraph or triples into the large language model for information fusion, reasoning, and generating decision output includes: The structured subgraph or triple is serialized into a text description, which is placed in front of the context of the large language model prompt. The prompt specifies that content is generated based on the structured subgraph or triple constraints, and multi-round reasoning is performed to integrate external retrieval information; The decision output is generated based on the fused information, and the decision output includes action instructions and cited facts. The large language model hints include knowledge graph pattern examples, and the injection process supports iterative queries to deepen reasoning.

[0009] Furthermore, the invocation of the tool executor to execute the action instructions in the decision output includes: The action instructions specify the tool type and input parameters, and the tool executor handles web page searches or API calls; The tool executor returns unstructured results, and the large language model parses the unstructured results and extracts supplementary knowledge; The execution result is fed back to the large language model, which evaluates the action completion status. The tool executor generates a call sequence based on the decision output, the call sequence integrating facts returned by the knowledge graph.

[0010] The step of extracting new entity relation triples from the execution result includes: Use prompt words to output JSON formatted triples from the execution result text end-to-end; The triple includes subject, predicate, object, and confidence level. The large language model performs entity disambiguation to determine knowledge graph nodes.

[0011] Furthermore, the step of injecting the triples into the knowledge graph for updating includes: Before injection, conflict detection is performed on the triples, and the conflict detection compares the consistency with existing knowledge. The knowledge graph expands the entity attributes or relational paths corresponding to the triples.

[0012] Furthermore, executing the knowledge graph query statement and returning a structured subgraph or triple includes: Entity nodes are matched according to the graph query language, and the structured subgraph contains relation edges and attribute values; The returned results are associated with domain-specific relationships, including competitors or technical routes, and the triplet format is uniformly defined as subject, predicate, and object.

[0013] Secondly, this invention provides an AI Agent system based on the collaboration of a large language model and a knowledge graph, comprising: The receiving and decomposition module is used to receive user input and understand the task intent, decompose the user input into a sequence of subtasks and formulate an execution plan, the execution plan including the query of the knowledge graph and the execution order of the tools; The generation and execution module is used to generate knowledge graph query statements, execute the knowledge graph query statements and return structured subgraphs or triples; The injection output module is used to inject the structured subgraph or triples into the large language model prompt, perform information fusion, reasoning, and generate decision output; The execution module is invoked to invoke the tool executor to execute the action instructions in the decision output. The tool executor interacts with the external environment and returns the execution result. The extraction and update module is used to extract new entity relation triples from the execution result and inject the triples into the knowledge graph for updating.

[0014] Furthermore, the receiving and decomposition module includes: An extraction unit is used to extract key entities and relationships from user input and determine the task intent based on the key entities and relationships; A decomposition unit is used to decompose the task intent into a sequence of subtasks, and the execution plan includes the knowledge graph query order of the subtask sequence.

[0015] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: This invention discloses an AI Agent method and system based on the collaboration of a large language model and a knowledge graph. By decomposing user input into a sequence of sub-tasks and formulating an execution plan, and integrating knowledge graph queries and tool calls, it achieves efficient reasoning and dynamic updates of multi-source information, solving the problems of information isolation and knowledge lag in complex business scenarios. It is particularly suitable for domains requiring real-time decision-making and knowledge expansion. This invention generates accurate graph query statements through a large language model, extracts key entity relationships, and injects structured knowledge into prompts using a collaborative reasoning engine, achieving content generation under factual constraints. Simultaneously, it calls tool executors to interact with the external environment and extracts new knowledge from execution results and user feedback to update the graph, ensuring knowledge consistency and scalability. This process forms a closed-loop mechanism, which not only improves the accuracy and adaptability of decision-making but also promotes the continuous evolution of knowledge, providing strong technical support for intelligent applications in dynamic environments. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of an AI Agent method based on the collaboration of a large language model and a knowledge graph according to the present invention.

[0017] Figure 2 This is another schematic diagram of an AI Agent method based on the collaboration of a large language model and a knowledge graph according to the present invention.

[0018] Figure 3 This is another schematic diagram of an AI Agent method based on the collaboration of a large language model and a knowledge graph according to the present invention.

[0019] Figure 4 This is another schematic diagram of an AI Agent method based on the collaboration of a large language model and a knowledge graph according to the present invention.

[0020] Figure 5 This is another schematic diagram of an AI Agent method based on the collaboration of a large language model and a knowledge graph according to the present invention. Detailed Implementation

[0021] The technical solutions of the present invention will be clearly and thoroughly described below with reference to the accompanying drawings of the embodiments. The described embodiments are merely some embodiments of the present invention.

[0022] like Figure 1-5 As shown, this embodiment provides an AI Agent method based on the collaboration of a large language model and a knowledge graph, which may specifically include the following steps: S1, receive user input and understand the task intent, decompose the user input into a sequence of sub-tasks and formulate an execution plan, the execution plan including the order of calling knowledge graph queries and tool execution.

[0023] The large language model receives natural language commands input by the user, performs semantic parsing on the input content to obtain the core intent and key entities, determines the task's goal and scope, and decomposes complex commands into multiple executable sub-task sequences. For each sub-task sequence, the large language model formulates a detailed execution plan based on pre-established task priorities and dependencies, specifying the execution order and required resources for each sub-task, and planning the timing and specific content for invoking the knowledge graph. Within the execution plan, the large language model further refines the steps for invoking the knowledge graph, determining the specific paths for retrieving relevant entities and relationships from the knowledge graph, and arranging the execution order of the tools to ensure the sub-task sequence proceeds as planned. For the tool execution order, the large language model generates corresponding parameter configurations and invocation instructions, ensuring that each sub-task in the execution plan is combined with the knowledge graph query results to form a complete workflow, completing the decomposition and planning of the user input task.

[0024] For example, the generation steps are as follows: For example, when the large language model receives natural language instructions input by the user, it processes them through a semantic parsing process. For instance, if the user inputs "analyze Tesla's competitors", the model first identifies "Tesla" as the core entity and "analyze competitors" as the intent. This ensures that the essence of the task is accurately captured, which is beneficial to the accuracy of subsequent decomposition.

[0025] In one possible implementation, the model further extracts keywords such as "competitors" and maps them to predefined intent categories, thereby determining the task scope as business analysis. This helps avoid ambiguity and improve overall response efficiency.

[0026] For the sub-task sequence obtained from the decomposition, the large language model formulates an execution plan based on the pre-established task priorities and dependencies. For example, "finding competitors" is set as a priority sub-task, which depends on the entity recognition results. This can optimize resource allocation and reduce execution latency.

[0027] In one possible implementation, the model explicitly defines the order of each subtask, such as querying the knowledge graph first and then analyzing the data, and plans the required resources, such as computing capacity. This helps to achieve seamless integration and improve the robustness of the plan. In this way, the timing of calling the knowledge graph query is set at the initial stage of the subtask, thereby ensuring that the information is available in a timely manner.

[0028] In the execution plan, the large language model further refines the steps for calling knowledge graph queries. For example, it determines the path to obtain the relationship of "Tesla's competitors" by traversing from the node "Tesla" to the node "Waymo". This helps to obtain accurate factual data and support reasoning.

[0029] In one possible implementation, the model arranges the execution order of the tool, such as retrieving first and then verifying. This can enhance the efficiency of the subtask sequence, help prevent information silos and form a coherent process. By refining the path, the query results are directly input into the tool execution, improving the integrity of the overall task.

[0030] For the execution order of the tools, the large language model generates corresponding parameter configurations and calling instructions, such as setting parameters for API tools like "query entity = Tesla", to ensure integration with the knowledge graph query results. This is beneficial for creating a complete workflow and completing the decomposition and planning of user input tasks.

[0031] In one possible implementation, the model integrates query results into instructions, such as using retrieved relationships to generate analysis reports. This improves accuracy and user satisfaction. Through this combination, the sequence of subtasks eventually forms a closed loop, achieving efficient task execution.

[0032] S2, Generate a knowledge graph query statement, execute the knowledge graph query statement and return a structured subgraph or triple.

[0033] The large language model extracts key entities and relationships from user-input natural language commands. It then performs semantic parsing on the input text, identifying core nouns and related words to form a preliminary set of semantic units for constructing subsequent query statements. For this set of semantic units, the large language model maps the extracted key entities and relationships to the query statement format of the knowledge graph based on a pre-established query template, generating a standardized statement conforming to the graph query language to ensure accurate correspondence between the query statement and nodes and edges in the graph. The generated query statement is transmitted to the knowledge graph database, which parses and executes it, matching corresponding subgraphs or triples from stored structured data to form a query result set. This query result set is returned to the large language model, which performs preliminary processing on the returned subgraphs or triples, converting them into contextual information usable for subsequent reasoning or answer generation, ensuring that the structured subgraphs or triples directly serve the user's input business objectives.

[0034] For example, when processing natural language commands input by users, the process of extracting key entities and relationships involves semantic parsing of the text by a large language model. This parsing identifies core nouns such as company names or product terms, as well as related words such as "competitors" or "technical routes," by decomposing sentence structures, thereby forming a preliminary set of semantic units. This set serves as basic data and ensures the accuracy of subsequent steps because it directly transforms user intent into actionable elements, improving the overall targeting of the query.

[0035] In one possible implementation, when a user queries “find Apple’s major suppliers”, the large language model first scans the input text, identifies “Apple” as the core entity and “major suppliers” as the relational term, and then combines these into a set of semantic units, such as labeling entities as node prototypes and relations as edge prototypes. This approach can lead to accurate extraction, avoid ambiguity, and provide reliable input for query construction.

[0036] It should be noted that the purpose of this extraction mechanism is to bridge the gap between natural language and structured queries, enabling the system to respond to complex requests more efficiently. For example, in business analysis scenarios, when user input involves multiple entities, this set can prevent information omissions and ensure completeness.

[0037] In one possible implementation, for the set of semantic units, the large language model uses pre-established query templates for mapping. These query templates are predefined patterns, such as those based on the Cypher language, used to transform entities and relations into canonical statements. For example, a template might include a framework like "matching the relation R between node A and node B," where A corresponds to the extracted entity and R corresponds to the relation. This generates statements that conform to the graph query language and can accurately correspond to nodes and edges in the graph. The beneficial effect of this mapping is to improve the standardization and execution efficiency of the query because it standardizes the input variations.

[0038] In one possible implementation, for the aforementioned set of semantic units "Apple's suppliers", the model selects a supplier relationship template and generates a statement such as "match (company: Apple) - [r: supplier] -> (s: supplier) return s". This not only ensures that the statement accurately matches the graph structure, but also brings the beneficial effect of fast retrieval, especially in dynamic knowledge environments, reducing the occurrence of erroneous queries.

[0039] It should be noted that this template mechanism connects the extraction and generation stages, making the conversion from semantic units to sentences seamless and improving the robustness of the system.

[0040] For example, after the generated query statement is transmitted to the knowledge graph database, the database performs matching by parsing the statement, finding the corresponding subgraph or triple data from the stored structured data to form a query result set. This parsing process includes decomposing the statement components, traversing graph nodes and edges to find paths that meet the conditions. For example, the database engine will verify entity matching one by one and collect relevant triples. This can bring the beneficial effects of accuracy and completeness of data retrieval because it directly filters out relevant subsets from massive amounts of knowledge.

[0041] In one possible implementation, for a supplier query, the database first locates the "apple" node, and then follows the "supplier" side to collect all connected supplier nodes, forming a result set such as a list of triples. This not only supports subsequent processing, but also reduces computational overhead through efficient matching, which is beneficial for real-time response.

[0042] It should be noted that the role of this execution stage is to transform abstract statements into actual data output, bridging the generation and return processes and ensuring the reliability of the result set.

[0043] In one possible implementation, after the query result set is returned to the large language model, the model performs preliminary processing on the returned subgraphs or triples, such as converting the triples into natural language descriptions or integrating them into contextual fragments for subsequent reasoning or answer generation. This ensures that the structured subgraphs or triples directly serve the business objectives input by the user. The beneficial effect of this processing is that it makes knowledge easier for the model to utilize and improves the fact-based accuracy of the answer.

[0044] For example, in vendor analysis, the returned triples are arranged as "Apple's vendors include A and B, whose technological advantage is X", which directly serves the user query and brings the effect of enhancing reasoning ability because it transforms structured data into a context that can inject hints.

[0045] It should be noted that this return and sorting process forms a closed loop, connecting the retrieval and application stages, making the entire process logically rigorous from input to output, and supporting the implementation of complex business functions such as competitive analysis.

[0046] S3, the structured subgraph or triple is injected into the large language model for information fusion, reasoning, and generation of decision output.

[0047] Structured subgraphs or triples related to the target task are extracted from the knowledge repository. These subgraphs contain nodes and edges corresponding to the core entities of the task and their relationships. The extracted content undergoes initial screening to ensure relevance and completeness, which is then used for subsequent context construction. The screened structured subgraphs or triples are transformed into contextual information described in natural language. This contextual information is organized in text format, and its content is sorted and formatted according to task requirements for easy integration into the language processing flow. The organized contextual information is injected into the language processing flow as prompts. These prompts, combined with the task objective, trigger a multi-source information fusion reasoning process. Semantic integration is performed on data from different sources to generate preliminary decision results. The generated preliminary decision results are then verified and supplemented. This verification process utilizes factual data from the knowledge repository for validation, adjusting for potential biases in the reasoning, ultimately forming a decision output that meets the task requirements, thus achieving the goal of multi-source information fusion reasoning.

[0048] For example, the generation steps are as follows: In one possible implementation, the process of extracting structured subgraphs or triples of data related to the target task from a knowledge repository first involves identifying the core entities of the task. For example, when the task is to analyze the competitive relationships between enterprises, the core entities may include specific company names and their associated suppliers. This ensures that the extracted data directly serves the task requirements and is beneficial to improving the targeting of subsequent processing. The subgraph contains nodes and edges, where nodes represent entities such as companies or technologies, and edges represent relationships such as cooperation or competition. A specific method for preliminary screening of the extracted content is to eliminate irrelevant items through matching degree calculation, such as filtering out nodes directly connected to the core entities. This helps to enhance the relevance and completeness of the data, thereby providing a solid foundation for context construction and avoiding irrelevant information from interfering with the overall process.

[0049] For example, when converting the filtered structured subgraphs or triples into contextual information described in natural language, a serialization method can be used to convert nodes and edges into sentence form. For instance, the triple "Company A-Supplier-Company B" can be converted into "Company A is a supplier of Company B". The advantage of organizing the contextual information in text form is that it facilitates compatibility with language processing workflows. The specific implementation of content sorting and format adjustment according to task requirements is to prioritize highly relevant information, such as listing the main competitive relationships first and then supplementing the technical details. This can optimize the logical fluency of the information, improve reasoning efficiency during subsequent injection, and avoid fusion deviations caused by cluttered information.

[0050] In one possible implementation, the process of injecting the processed contextual information as prompts into the language processing flow involves combining the prompts with the task objectives. For example, in a business analysis task, the prompts might include "Assess the risks based on the following supplier relationships." A specific method to trigger the multi-source information fusion reasoning process is to semantically integrate data from different sources, such as combining subgraph facts with external inputs. This helps generate preliminary decision results and is beneficial for achieving comprehensive reasoning because it supports the accuracy of the decision from multiple perspectives. For example, integrating internal knowledge with real-time data to infer potential risks forms a coherent thought chain, ensuring that the output does not deviate from the factual basis.

[0051] For example, the process of verifying and supplementing the generated preliminary decision results can be achieved by cross-referencing factual data from the knowledge repository. For instance, the relationships mentioned in the decision are matched with triples in the repository. If discrepancies are found, adjustments are made, such as supplementing missing descriptions of technical advantages. This can optimize for possible biases in the reasoning and is beneficial to forming a decision output that meets the task requirements. This is because the reliability of the result is supported from multiple directions. For example, when verifying a competitor's technical route, supplementing factual data can enhance the depth of fusion reasoning and achieve the goal of multi-source information fusion reasoning.

[0052] S4, invoke the tool executor to execute the action instructions in the decision output, the tool executor interacts with the external environment and returns the execution result.

[0053] After generating the decision output, the large language model parses the action instructions to determine the specific tool executor to be invoked and generates corresponding invocation parameters, completing the initial preparation of the instructions. The tool executor interacts with the external environment based on the parsed invocation parameters, executing specific action instructions, such as obtaining external data through interface calls or triggering specific operations, and recording state information during execution. After completing the interaction, the tool executor returns the execution result to the large language model in a structured format for subsequent processing and judgment, ensuring that the returned data can be further parsed. The large language model receives the execution result returned by the tool executor, integrates the result content, and generates final feedback that conforms to the decision output, ensuring the complete closed-loop interaction with the external environment.

[0054] For example, after the large language model generates the decision output, the process of parsing the action instructions can be carried out by using natural language processing technology to identify the keywords and structures in the instructions. For example, "query supplier information" can be parsed into calling a database query tool and generating parameters such as query keywords and filtering conditions. This ensures that the instructions are accurately converted into an executable form, which is beneficial to improving system response efficiency and reducing errors.

[0055] In one possible implementation, the tool executor interacts with the external environment based on these parsed call parameters. For example, in a business analytics scenario, it may call an external database through an API interface to obtain supplier data or trigger a web crawler to collect real-time information and record status such as interaction duration and success flags. This process is beneficial for achieving real-time data acquisition, ensuring the traceability of action instructions, and thus improving the overall system reliability and data integrity.

[0056] It should be noted that after the tool executor completes the interaction, it returns the execution results to the large language model in a structured format such as JSON. For example, the returned data includes a list of queried suppliers and technical details, which is used to determine whether further action is needed. This allows the model to quickly parse the results, which is beneficial for forming an efficient feedback loop and avoids problems such as information loss or format incompatibility.

[0057] In one possible implementation, after receiving the returned execution results, the large language model integrates their content, such as combining the acquired supplier data with the analysis requirements in the decision output, to generate final feedback such as a risk assessment report. This integration process is beneficial for seamlessly integrating external interaction results into the decision, ensuring the integrity of the closed loop, and supporting multiple rounds of iterative optimization.

[0058] For example, from another perspective, in a medical diagnostic agent, a large language model parses action instructions such as "retrieve patient history" to determine which electronic medical record system tool to call, generating parameters including the patient ID. This parsing helps to accurately match tools and improve diagnostic accuracy. The tool executor interacts with external medical databases, recording status such as encrypted data transmission, and returning structured results such as medical history JSON, which helps to protect privacy and facilitate integration. Finally, the model integrates the results to generate diagnostic suggestions, ensuring that the interaction with the external environment forms a reliable closed loop and supporting continuous learning.

[0059] In one possible implementation, for financial risk assessment, instructions such as "calculate credit score" in the decision output are parsed, an external credit API is called, parameters such as user data are generated, and after interaction, scores and logs are returned and integrated into a risk report. These multiple examples support each other and jointly emphasize the synergistic effect of parsing, interaction, return and integration, which is beneficial to achieving an efficient and accurate closed loop of external environment interaction in different fields.

[0060] S5, extract new entity relation triples from the execution result, and inject the triples into the knowledge graph for updating.

[0061] Raw data is obtained from execution results and user feedback. The large language model performs semantic parsing on this data to identify potential entities and relationships, forming preliminary entity-relation pairs. Each entity-relation pair includes at least one subject, object, and a description of their association. For these preliminary entity-relation pairs, the large language model transforms them into standardized triples using pre-established semantic matching rules. Each triple contains a clearly defined subject, predicate, and object, ensuring consistency between the data structure and the knowledge graph's storage format. After the triples are generated, they are injected into the knowledge graph. The injection process compares the triples with existing entities and relationships in the knowledge graph to determine whether new or updated content is needed. If conflicts exist, they are handled according to preset priority rules. After triple injection, the knowledge graph update process triggers the recalculation of associated nodes, ensuring consistency in the attributes and relationships of related entities in the graph, thereby achieving the goal of knowledge evolution.

[0062] For example, the generation steps are as follows: For example, after obtaining raw data from execution results and user feedback, the process of semantic parsing by the large language model involves word-by-word analysis of the text content to identify potential entities and relationships.

[0063] For example, when the execution result shows "Supplier A provides chips to Company B", the model will parse out the entities "Supplier A" and "Company B", as well as the relationship "provide chips", forming a preliminary entity relationship pair. This pair includes subjects such as "Supplier A", objects such as "Company B" and their associated descriptions such as "provide chips". This ensures that useful information is extracted from messy data, which is beneficial to the accuracy of subsequent knowledge updates because it transforms unstructured input into a processable structure, thereby avoiding information loss and improving the system's ability to adapt to new knowledge.

[0064] In one possible implementation, for initial entity relation pairs, the large language model applies pre-established semantic matching rules to transform them into a canonical triple format, which are based on matching templates defined by the language pattern.

[0065] For example, matching "Supplier A provides chips to Company B" into a triple (Supplier A, provide, chips to Company B), where the subject is "Supplier A", the predicate is "provide", and the object is "chips to Company B", ensures consistency with the knowledge graph storage format. This transformation process verifies entity integrity through rules, which helps prevent data ambiguity because it standardizes relational expressions, making it easier to integrate existing knowledge when injecting into the graph and enhancing the overall consistency of the system, supporting the reliability of knowledge evolution from multiple perspectives.

[0066] For example, after the triplet format is generated, the process of injecting it into the knowledge graph includes comparing existing entities and relations.

[0067] For example, if the graph already contains a relationship between "Supplier A" and "Company C", the new triple "Supplier A provides chips to Company B" will be considered a new addition. When handling conflicts, updates are performed according to preset priority rules, such as timestamp priority. In detail, this comparison and judgment mechanism first queries the graph nodes. If a match is found, the attributes are merged; otherwise, a new node is created. This is beneficial for maintaining the integrity of the graph because it ensures that data is not redundant from the perspective of conflict resolution and improves the timeliness of knowledge from the perspective of updating. Multiple aspects, such as entity merging and relationship verification, support each other and form a closed loop to achieve dynamic knowledge management.

[0068] In one possible implementation, after the triple injection is completed, the knowledge graph update process triggers the recalculation of associated nodes.

[0069] For example, after injecting the "triple (supplier A, provides chips to company B)", the system will recalculate the supply chain attributes of "company B" to ensure the consistency of relationships between related entities such as competitors. This recalculation process involves traversing adjacent nodes and adjusting weights, which is beneficial to the coherence of the graph because it prevents inconsistencies caused by isolated updates. From an evolutionary perspective, it can bring about continuous optimization of knowledge. Multiple aspects, such as node traversal and attribute adjustment, support each other and ultimately closely adhere to the goal of achieving knowledge evolution.

[0070] S21, The large language model generates a knowledge graph query statement, including the large language model translating a natural language question into a graph query language, wherein the graph query language conforms to the knowledge graph pattern and specifies entity paths and attribute filtering.

[0071] The large language model extracts key information from natural language input, parses the user's question, identifies core entities and relational descriptions, and transforms them into structured semantic units for subsequent processing. These structured semantic units are mapped to a knowledge graph schema. Based on pre-established graph structure rules, the large language model matches the parsed entity and relational descriptions with the node and edge types in the graph to determine the target path and relevant attribute conditions for the query. A query statement conforming to the knowledge graph schema is generated. Using the matched target path and attribute conditions, the large language model constructs a standardized statement conforming to the graph query language, including constraints on specified entity paths and attribute filtering, ensuring the query statement can accurately access relevant data in the knowledge graph. The syntax and semantics of the query statement are verified. The large language model performs internal validation on the generated query statement to determine whether it conforms to the syntax rules of the graph query language and confirms that the path and attribute filtering in the statement are consistent with the actual structure of the knowledge graph, ensuring the query statement can be used for subsequent data acquisition.

[0072] In one possible implementation, the process of extracting key information from natural language input involves a large language model parsing the user's question.

[0073] For example, when a user queries "What are Tesla's competitors?", the large language model first identifies core entities such as "Tesla" and relational descriptions such as "competitors", and transforms them into structured semantic units. This transformation helps with subsequent mapping, avoids ambiguity, and thus improves query accuracy and the efficiency of overall knowledge graph query.

[0074] In one possible implementation, when mapping structured semantic units to patterns in a knowledge graph, the large language model matches them according to pre-established graph structure rules.

[0075] For example, matching "Tesla" as a node type "company" and the relationship "competitor" as an edge type "rival" determines the target path of the query, such as the path from "Tesla" to the "competitor" company, as well as attribute conditions such as "technology field = autonomous driving". This matching ensures that the query path conforms to the graph logic, which is beneficial for generating accurate statements and reducing invalid searches.

[0076] In one possible implementation, a query statement conforming to the knowledge graph pattern is generated, and a canonical statement is constructed using the matched target path and attribute conditions.

[0077] For example, constructing a Cypher statement "MATCH (c:Company {name:'Tesla'})-[r:rival]->(comp:Company) WHERE comp.field='Autonomous Driving' RETURN comp", which includes constraints specifying entity paths and attribute filtering, allows queries to accurately access relevant data, thus improving system response speed and factual accuracy.

[0078] In one possible implementation, the syntax and semantics of the query statement are validated through internal verification of the large language model.

[0079] For example, checking whether the statement conforms to Cypher syntax rules, such as correct path syntax, and confirming that the path and attribute filtering are consistent with the actual structure of the knowledge graph. If they are inconsistent, they are adjusted. This kind of verification ensures that the query statement can be used for data retrieval, helps prevent erroneous execution, and improves system reliability and query success rate.

[0080] For example, in a business analytics scenario, the entire process, from extracting key information to verifying the query statement, forms a closed loop.

[0081] For example, when a user asks "Analyze Apple's supply chain partners", the large language model parses the entity "Apple" and the relationship "supply chain partners", maps them to a graph pattern to determine the path such as "company-supply-partner", generates the statement "MATCH (a:Company{name:'Apple'})-[s:supply]->(p:Partner) RETURN p", and then verifies the syntax to ensure that it is error-free. This chained processing is beneficial for achieving efficient knowledge retrieval and supporting complex business decisions.

[0082] For example, from another perspective, in medical knowledge queries, such as "find the side effects of a certain drug", the entity "drug" and the relation "side effects" are extracted, mapped to the graph path "drug-cause-side effects", and a SPARQL statement is generated and its consistency is verified. This multi-directional application supports each other, which is beneficial for cross-domain adaptability, ensures that the query statement is accurately translated from natural language questions into graph query language, conforms to the knowledge graph pattern, and specifies entity paths and attribute filtering.

[0083] S22, the knowledge graph returns a structured subgraph or triple, including the subgraph containing related entity nodes, relation edges and attribute values, and the triple format being subject, predicate and object with associated confidence.

[0084] A structured subgraph related to the target entity is obtained from the knowledge graph. This subgraph contains at least one entity node, relationship edges between nodes, and corresponding attribute values, ensuring that the subgraph covers both direct and indirect associations of the target entity, forming a preliminary set of knowledge fragments. For this preliminary set of knowledge fragments, triples conforming to the subject-verb-object format are extracted. These triples are formatted according to pre-established rules to ensure that each triple contains a subject, verb, and object, and a confidence value is associated with each triple for subsequent verification. After extracting the triples, the confidence values ​​are calibrated. Calibration incorporates contextual information about entities and relationships in the knowledge graph, adjusting the confidence values ​​to reflect the reliability of the triples, thus forming the final set of triples. The final set of triples is integrated with the structured subgraph. The integration process retains the node and relation edge information of the subgraph, and supplements the specific subject-predicate-object content and confidence in the form of triples. This ensures that the returned knowledge fragments contain both graphical structure and formatted factual descriptions, meeting the requirements of knowledge graphs to return structured subgraphs or triples.

[0085] For example, when processing business analysis tasks, obtaining structured subgraphs related to target entities from a knowledge graph can effectively capture multi-layered relationships between entities. For instance, for the target entity "Tesla", the subgraph would include nodes of direct competitors such as "Waymo", as well as nodes of indirect relationships such as technology suppliers. This acquisition method ensures the comprehensiveness of knowledge, thereby improving the accuracy of subsequent processing.

[0086] In one possible implementation, the structured subgraph contains at least one entity node, the relationship edges between nodes, and the corresponding attribute values, which provides a more reliable knowledge base because the subgraph covers directly related information such as "competitor" relationship edges and indirectly related information such as "technology route" attribute values. This helps to avoid information omissions and provides complete contextual support.

[0087] Specifically, after forming a preliminary set of knowledge fragments, triples that conform to the subject-predicate-object format are extracted from the set. The data is then formatted using pre-established rules, which enhances the standardization of the data. For example, the triple "Tesla-competitor-Waymo" can be extracted from the subgraph, and each triple is ensured to contain a subject, predicate, and object. This extraction improves the queryability of knowledge and lays the foundation for association confidence values, thereby making the verification process more efficient.

[0088] In one possible implementation, a confidence value is associated with each triple for subsequent verification, which can significantly improve the reliability of knowledge. For example, the confidence value is calculated based on the credibility of the source, and a high confidence triple such as 0.95 indicates strong factual support. This can filter out low-quality information and bring more accurate decision-making basis.

[0089] Specifically, after extracting the triples, the confidence values ​​of the triples are calibrated. The confidence values ​​are adjusted in combination with the contextual information of entities and relations in the knowledge graph, which can reflect the true reliability of the triples. For example, if the context shows that Waymo's technical route highly overlaps with Tesla's, the confidence value is increased to 0.98. This calibration helps to eliminate bias and form the final set of triples, thereby enhancing the robustness of the overall knowledge.

[0090] In one possible implementation, after forming the final set of triples, it is integrated with the structured subgraph, retaining the node and relation edge information of the subgraph, and supplementing the specific subject, predicate, object content and confidence level in the form of triples. This enables a comprehensive expression of knowledge. For example, in the integrated result, the subgraph graphically displays the node connections, and the triples list "Tesla - Technology Used - LiDAR" with confidence level annotation. This provides both graphical and formatted descriptions to meet diverse query needs.

[0091] Specifically, ensuring that the returned knowledge fragments contain both graphical structures and formatted factual descriptions provides a user-friendly interactive experience. For example, in autonomous driving analysis, users can intuitively view subgraph relationships and verify factual accuracy through triples. This integration method enhances the practical value of knowledge graphs and supports accurate responses to complex tasks.

[0092] S211, the large language model translates natural language questions into graph query languages, including the large language model combining knowledge graph pattern examples to generate Cypher or SPARQL statements, which are targeted at specific domain relationships such as competitors or technology routes.

[0093] The large language model extracts key information from user-input natural language questions. First, it parses the input, identifying core entities and relational descriptions, such as keywords related to competitors or technological approaches in specific domains, and organizes these into structured semantic units for subsequent processing. These structured semantic units are then mapped onto knowledge graph patterns. Based on pre-established graph pattern examples and the extracted entity and relational descriptions, the large language model generates a preliminary query framework, performing semantic alignment for specific domain relationships to ensure consistency with the graph structure. Next, the preliminary query framework is transformed into a standardized graph query language. Based on the generated query framework and pre-defined syntax rules, the large language model generates query statements conforming to Cypher or SPARQL formats, accurately expressing specific domain relationships such as competitors or technological approaches. Finally, the generated query statements are validated and optimized. The large language model compares the generated Cypher or SPARQL statements with the knowledge graph patterns to determine if they meet grammatical requirements and performs semantic integrity checks for specific domain relationships, ensuring that the statements accurately reflect the user's intent and are suitable for subsequent queries.

[0094] For example, in the process of extracting key information from a natural language question input by a user, the large language model first parses the input content. For instance, if a user queries "analyze Tesla's competitors and their technology routes", the large language model identifies core entities such as "Tesla" and relational descriptions such as "competitors" and "technology routes", and organizes them into structured semantic units. This extraction ensures the accuracy of subsequent mapping, thereby improving the precision of the query and helping to avoid mistranslations caused by ambiguity.

[0095] In one possible implementation, when mapping structured semantic units to patterns in a knowledge graph, the large language model generates a preliminary query framework based on pre-established graph pattern examples, such as nodes defined in the pattern like the "company" node and edges like the "competition" edge, combined with extracted entity and relation descriptions. Semantic alignment is then performed for domain-specific relations, such as aligning "competitor" to the "rival" relation in the graph, ensuring that the query framework is consistent with the graph structure. This enhances the reliability of the translation and leads to more stable query results.

[0096] For example, in the process of transforming the initial query framework into a standardized graph query language, the large language model generates query statements conforming to Cypher format based on the generated query framework and preset syntax rules. For example, it generates "MATCH (c:Company {name:'Tesla'})-[:COMPETES_WITH]->(r:Company) RETURNr.name, r.tech_route", which accurately expresses specific domain relationships such as competitors or technology routes. This transformation can bridge the gap between natural language and structured queries, which is beneficial to improving the system's response efficiency.

[0097] In one possible implementation, during the step of validating and optimizing the generated query statement, the large language model determines whether the generated Cypher statement conforms to the grammatical requirements by comparing it with the pattern of the knowledge graph. For example, it checks whether the nodes and relationships in the statement match the graph definition and performs semantic integrity checks on specific domain relationships, such as verifying whether "technical route" fully covers the user's intent. This ensures that the statement can accurately reflect the user's intent and be used for subsequent queries, thereby reducing the risk of erroneous execution and bringing higher query accuracy and user satisfaction.

[0098] For example, the implementation of extracting key information can be examined from multiple perspectives. For instance, in a business analysis scenario, when user input involves supply chain risks, the large language model extracts entities such as "suppliers" and relationships such as "risk factors," organizes them into semantic units, and supports subsequent mapping. In a technology assessment scenario, "technological advantages" are extracted as a relationship description to ensure accurate alignment when the framework is generated. These aspects support each other and form a complete translation chain, which is beneficial to the system's adaptability in different fields.

[0099] In one possible implementation, for example of mapping to a knowledge graph pattern, the principle is that the pre-built graph pattern example is a template for storing entities and relationships. For example, the pattern example includes node attributes and edge types. The process of extracting content to generate a framework is achieved through semantic matching, such as mapping user relationships to pattern edges to ensure consistency. This can prevent the problem of pattern mismatch and bring about more robust query generation.

[0100] For example, multiple directions of query language transformation support each other. In Cypher generation, path matching statements are generated for competitor relationships, while attribute return statements are generated for technical routes. These directions support each other to ensure the comprehensiveness of the statements, which is beneficial for covering complex query needs.

[0101] In one possible implementation, the analysis process of validation and optimization, such as when comparing patterns, if a syntax error is found, such as a missing return clause, it is optimized and added to ensure semantic integrity. This can improve the quality of the statement from both syntactic and semantic levels, resulting in reliable execution of the final query.

[0102] S31, the collaborative reasoning engine injects the structured subgraph or triples into the large language model prompt, including the injection process serializing the triples into a text description and placing it at the front of the prompt context, wherein the prompt specifies content generated based on fact constraints.

[0103] The system retrieves structured subgraphs or triples related to the user's request from a knowledge repository, using them as initial factual basis to constrain the subsequent content generation process. This retrieval process includes identifying key entities and relationships in the user input and extracting corresponding subgraph information from the repository using pre-established query rules, completing initial factual organization. The extracted structured subgraphs or triples are then serialized and transformed into natural language text descriptions, ensuring the text descriptions clearly express the relationships and attributes between entities. This transformation process includes expanding triples into sentences according to a preset grammatical template and organizing these sentences into a coherent descriptive text. The transformed text description is placed at the beginning of the prompt context as guiding information input into the language generation module, ensuring the generated content is based on factual evidence. This placement process includes combining the text description with the user's original input request to form complete prompt content, adjusting the position and priority of the descriptive text according to preset formatting rules. The prompt content explicitly specifies that the answer should be generated based on factual constraints, ensuring the generation module prioritizes the information in the text description during processing. The specified process includes adding restrictive statements to the prompts, guiding the generation module to rely primarily on the text descriptions during understanding and reasoning, thereby completing the output of content that conforms to the facts and closely adhering to the core objective of fact injection in collaborative reasoning.

[0104] For example, the generation steps are as follows: In one possible implementation, when retrieving structured subgraphs or triples from a knowledge repository, key entities and relationships in the user input are first identified. For example, when a user query involves a specific company name and supply chain relationships, the corresponding subgraph information is extracted using pre-established query rules. This extraction ensures the accuracy of the initial factual basis, thereby providing a reliable foundation for the subsequent constraint content generation process and improving the overall authenticity of the answer.

[0105] Specifically, the acquisition process involves parsing user input text, extracting keywords such as entities like "supplier" and relationships like "technical advantages," and then applying query rules to match data in the repository to form a preliminary factual summary. This approach helps reduce interference from irrelevant information and achieves more accurate knowledge utilization.

[0106] It should be noted that this approach ensures timely availability of factual information and prevents generated content from deviating from reality.

[0107] In one possible implementation, when the extracted structured subgraphs or triples are serialized, they are transformed into text descriptions in natural language form. For example, a triple such as "Company A-Supply-Semiconductor" is expanded into the sentence "Company A is a major supplier of semiconductors" and organized into coherent text. This transformation ensures a clear expression of the relationships and attributes between entities, which is beneficial to the smooth progress of the subsequent injection process.

[0108] Specifically, the transformation process uses a preset grammar template to expand triples one by one, such as the template "Entity 1 is connected to entity 2 through a relation and has attribute values". After generating multiple sentences, they are integrated into paragraphs. This method helps to transform abstract data into an easy-to-understand form and improves the understanding efficiency of the language generation module.

[0109] It should be noted that doing so can bring coherence and readability to the text description and strengthen the role of facts in the prompt.

[0110] In one possible implementation, when the transformed text description is placed at the beginning of the prompt context, it serves as guiding information input to the language generation module. For example, placing the descriptive text before the user request forms a complete prompt such as "Based on the following facts: Company A supplies semiconductors... Please analyze supply chain risks." This placement ensures that the generated content is based on factual evidence and helps to constrain the output direction of the generation module.

[0111] Specifically, the placement process combines text descriptions with the original request, adjusting the position and priority according to preset formatting rules. For example, the description is placed first to highlight its guiding role. This adjustment helps the module refer to factual information first during processing, avoiding the generation of fictitious content.

[0112] It should be noted that this approach optimizes the structure of the prompts and improves the reliability of the generated answers.

[0113] In one possible implementation, when explicitly specifying in the prompt content that the response is generated based on factual constraints, the generation module is ensured to prioritize the information in the text description. For example, a constraint statement such as "Strictly based on the provided text description to generate content, avoiding the addition of unverified information" is added to the prompt. This specification guides the module to take the description as the main basis and complete the output of content that conforms to the facts, which is beneficial to closely adhering to the core goal of fact injection in collaborative reasoning.

[0114] Specifically, the specified process involves inserting restrictive statements at the end of prompts or key locations, such as "factual constraints must be followed during generation." This guidance helps modules maintain fact-orientation during understanding and reasoning, ensuring consistency and accuracy in output.

[0115] It should be noted that doing so can enhance the constraints on the generated content and prevent deviations from occurring.

[0116] S41, the large language model calls the tool executor to execute the action instructions in the decision output, including the action instructions specifying tool type parameters and input data, and the tool executor processes web page searches or API calls and returns unstructured results.

[0117] Upon receiving an action command, the large language model first parses the specified tool type parameter and input data in the command to determine the type of tool to be invoked, such as a web search tool or an external interface calling tool. It then formats the input data into a format suitable for tool processing, generating an execution request. From the request, the tool type and formatted input data are obtained. The tool executor selects the corresponding execution path based on the tool type, passes the input data to the web search tool or external interface calling tool, performs the corresponding data acquisition operation, and obtains preliminary unstructured return content. For this preliminary unstructured return content, the tool executor performs format validation and content preprocessing to ensure that the return content meets preset structural requirements, generating a standardized unstructured result for subsequent parsing. Key information is extracted from the standardized unstructured result, and the tool executor feeds the processed result back to the large language model for subsequent decision output or further action command generation, ensuring a complete closed-loop execution process for the action command.

[0118] In one possible implementation, after receiving the action instruction, the large language model determines the invocation category by parsing the specified tool type parameters and input data. This parsing process involves breaking down the instruction into identifiable elements, such as mapping the parameters in the "search supplier information" instruction to a web search tool, thereby generating a formatted invocation request. This ensures the accuracy of subsequent execution and helps reduce system latency caused by erroneous invocations.

[0119] Specifically, when the input data contains query keywords, the model will organize it into a uniform format, such as a JSON structure. This helps the tool executor to receive it seamlessly, avoids data incompatibility issues, and thus improves overall response efficiency.

[0120] For example, in a business analytics scenario, if the action instruction specifies using an external interface to call a tool to query company data, the request generated after model parsing will include an authentication token and query parameters, ensuring secure access to external resources, protecting data privacy, and supporting the smooth execution of complex queries.

[0121] In one possible implementation, after obtaining the tool category from the call request, the tool executor selects the execution path and passes the input data to the corresponding tool. This step is achieved through a path selection mechanism. For example, the tool is routed to a web search tool based on the category. This tool will initiate a network request based on the input data to obtain unstructured text such as news pages and return preliminary content. This can expand the system's information acquisition capabilities and is beneficial for integrating real-time data to enhance decision-making.

[0122] Specifically, if the category is an external interface call, the executor will construct an HTTP request and process the response, obtaining the returned content in JSON or HTML format. This helps to handle diverse data sources, avoids the limitations of a single tool, and thus improves the adaptability of the system.

[0123] For example, when analyzing supply chain risks, the actuator passes search keywords to web tools to obtain unstructured descriptions from supplier reports, which is beneficial for the comprehensiveness of subsequent analysis and supports complementary verification information from multiple sources.

[0124] In one possible implementation, format validation and content preprocessing are performed on the initial unstructured returned content to ensure that it meets the preset structural requirements. This involves validation such as encoding consistency and integrity. Then, preprocessing removes noise and generates standardized results. This improves data quality and benefits the reliability of downstream parsing.

[0125] Specifically, preprocessing may include text cleaning and structure transformation, such as converting HTML content into plain text, which helps eliminate irrelevant elements, improves the readability of the results, and thus optimizes the feedback process.

[0126] For example, when processing search results, if the returned content contains redundant tags, preprocessing will strip them to generate clean text, which is beneficial for the efficient integration of large language models and avoids decision bias caused by parsing errors.

[0127] In one possible implementation, after extracting key information from the standardized unstructured results, the tool executor feeds it back to the large language model for subsequent decision output. This step is achieved through information extraction techniques, such as keyword matching, to extract entities. This closes the execution process and is beneficial for the system's adaptive learning.

[0128] Specifically, the feedback results can include extracted entities and relationships, supporting the model in generating further action instructions and ensuring continuity.

[0129] For example, in competitor analysis, after extracting feedback on technical routes, the model can plan the next step of the query based on this feedback, which is beneficial for building a complete knowledge chain and improving the depth of analysis.

[0130] S51, the large language model extracts new entity relation triples from the execution results and user feedback, including the extraction process using prompt words to output JSON format triples from the text end-to-end, and the triples are injected into knowledge graph nodes and edges after verification.

[0131] The system extracts content to be processed from the text of execution results and user feedback. This content includes dialogue records and task execution log data. For this text data, a large language model is guided by pre-designed prompts to extract entities and relations. These prompts require structured output of JSON data in a specific format, including entity names, entity types, and descriptions of relationships between entities, forming a preliminary set of triples. The preliminary set of triples is then validated for completeness and logical consistency. This validation compares the entities and relations in the triples with nodes and edges in the existing knowledge graph. If inconsistencies or omissions are found, the triples are marked as pending verification, ensuring the reliability of data in subsequent processing. The triples marked as pending verification are injected into a temporary storage area of ​​the knowledge graph. This temporary storage area stores unconfirmed content. Within this area, the accuracy of the triples is further assessed according to preset rules. If the injection conditions are met, the triples are formally converted into nodes and edges in the knowledge graph. The nodes and edges that are formally injected into the knowledge graph are updated in association. The update includes adjusting the connection weights and relationship descriptions between related nodes to ensure the structural integrity of the knowledge graph. At the same time, the injection process is logged for subsequent optimization and adjustment of extracting new entity relationship triples, which closely follows the goal of extracting new entity relationship triples from the execution results and user feedback and injecting them into the knowledge graph.

[0132] For example, the generation steps are as follows: In one embodiment, when retrieving content to be processed from the text of execution results and user feedback, the dialogue records may contain user queries such as analyzing competitors' technical routes, while the task execution log data records the output results after querying the knowledge graph. This ensures that the retrieved content covers the actual interaction details, which is beneficial to the comprehensiveness of subsequent extraction.

[0133] Specifically, pre-designed prompts guide the large language model to extract entities and relationships. For example, prompts can be described as identifying company names as entity names and industry categories as entity types from text, and describing relationships such as supply relationships as entity relationship descriptions. The output JSON data contains Tesla as an entity name, car manufacturers as entity types, and competitors as relationship descriptions, forming a preliminary set of triples. This approach can improve the accuracy of structured output and help reduce manual intervention.

[0134] In one embodiment, when verifying the content integrity and logical consistency of the initial set of triples, the entities and relations in the triples are matched with the nodes and edges in the existing knowledge graph. For example, if a triple shows that a company is a competitor but there is no such relation in the knowledge graph, it is marked as triple data to be verified. This verification can ensure the reliability of the data and help avoid the injection of erroneous information.

[0135] Specifically, this matching process involves checking whether the entity name corresponds to an existing node and whether the relationship description conforms to the logic of the existing edges. If inconsistencies are found, such as missing technical route relationships, the reliability of the data in subsequent processing is ensured by marking them. This can improve the stability of the overall knowledge update and is beneficial to the long-term evolution of the system.

[0136] In one embodiment, when injecting triplet data marked as to be verified into the temporary storage area of ​​the knowledge graph, this area serves as a buffer to store content that has not yet been finalized. For example, the injected data may include supplier relationship triplets to be verified. Within this area, the accuracy of the triplet is judged a second time by preset rules such as consistency threshold. If the injection / injection conditions are met, such as the accuracy rate being higher than the preset threshold, the triplet is formally converted into a node and edge in the knowledge graph. This injection can bring reliability to the graph expansion and is beneficial to improving query efficiency.

[0137] Specifically, the secondary judgment process involves the application of rules such as checking the matching degree between triples and contextual semantics to ensure that only highly reliable data is converted into nodes and edges. This can improve the integrity of the knowledge graph and benefit the accuracy of subsequent reasoning.

[0138] In one embodiment, when updating the associations of nodes and edges formally injected into the knowledge graph, the connection weights between related nodes are adjusted, such as by increasing the weight value based on the strength of the relationship, and the relationship descriptions are updated to match new facts. For example, the connection weights between Tesla and its competitors are updated to reflect the latest technological advantages. Such updates can enhance the structural integrity and benefit the dynamic adaptability of the graph.

[0139] Specifically, the injection process is logged, including timestamps and source details, for subsequent optimization and adjustment of new entity relation triples. For example, logs show that previously extracted low-accuracy prompts can be optimized accordingly. This logging enables continuous improvement of the extraction process and helps to stay aligned with the goal of extracting new entity relation triples from execution results and user feedback and injecting them into the knowledge graph.

[0140] S511, the large language model injects the triples into the knowledge graph for updating, including performing conflict detection before injection to verify the consistency of existing knowledge, and updating and expanding entity attributes or adding relationship paths to support future queries.

[0141] The system retrieves triple data to be updated from the existing knowledge graph. A preliminary comparison is performed between the triples and existing entities and relationships in the graph to identify potential conflicts, such as inconsistent entity attribute values ​​or duplicate relationship paths. The location and type of these conflicts are recorded, generating a conflict detection report. For inconsistencies recorded in the conflict detection report, the attribute values ​​and relationship paths of the triples are validated to determine whether existing data needs to be overwritten or the relationship connection method adjusted. If attribute value conflicts are detected, data with more recent timestamps is prioritized, generating a validated triple set. This validated triple set is injected into the knowledge graph. Before injection, the entity attributes of the graph are expanded, adding necessary attribute fields to accommodate new data content. Simultaneously, new connection logic is constructed for updated relationship paths to ensure the integrity of the graph structure, resulting in an updated graph version. In the updated graph version, the indexes for the newly added relationship paths and expanded entity attributes are optimized to ensure quick location of relevant data during future queries, completing the knowledge graph update process to support subsequent query needs.

[0142] For example, during the knowledge graph update process, when obtaining the triple data to be injected from the existing graph, the triple can be matched with existing entities by traversing the graph nodes. For instance, a triple represents "Apple Inc. - Founder - Steve Jobs". If the graph already has the same entity but the attribute value is "Tim Cook", the conflict point of inconsistent attribute value is determined after comparison, and the position such as node ID and the type such as value conflict are recorded to form a conflict detection report. This can identify problems early to maintain the accuracy of the graph and is beneficial to the reliability of subsequent updates.

[0143] In one possible implementation, in response to inconsistencies recorded in the conflict detection report, the attribute values ​​of the triples are validated. For example, if the timestamp of the founder of "Apple Inc." shows that the new data is more recent, it is determined that the old data needs to be overwritten, the relationship connection method is adjusted to avoid duplicate paths, and a validated set of triples is generated. This process ensures data consistency and brings about the technical effect of improving the overall quality of the graph, because prioritizing the retention of new data can reflect real-time changes and support more accurate knowledge representation.

[0144] It should be noted that when injecting the validated set of triples into the knowledge graph, the entity attributes are expanded before injection. For example, an attribute field such as "market capitalization" is added to the "Apple Inc." entity to accommodate new data content. At the same time, new connection logic is built for the relational paths, such as adding the path "Apple Inc. - Product - iPhone" to ensure the integrity of the graph structure and form an updated graph version. The purpose of this expansion and construction is to enhance the scalability of the graph, which is beneficial for handling diverse knowledge, avoiding data loss or isolation, and thus providing a solid foundation for complex queries.

[0145] In one possible implementation, the updated graph version optimizes the index for newly added relationship paths. For example, it uses a hash index to quickly locate data related to "iPhone," ensuring a rapid response during future queries and completing the knowledge graph update process to support subsequent query needs. This optimization improves query efficiency because the optimized index reduces traversal time, thus supporting the overall usability of the graph in practical applications.

[0146] For example, from another perspective, if the triple involves "Paris-Capital-France", the conflict detection report may record duplicate relationship paths. If an existing path overlaps with a new path, it is adjusted to a unique path after verification. During injection, entity attributes are expanded, such as by adding a "population" field, and new connections are built, such as "Paris-Famous Landmarks-Eiffel Tower". Finally, index optimization ensures that when querying "French capital landmarks", the relevant path is directly accessed. This multi-faceted processing mutually supports the goals of graph consistency and query support, because conflict detection and verification lay the foundation, injection expands and enriches the content, and optimization directly improves performance, forming a complete technology chain that is beneficial to the application effect of knowledge graphs in natural language question answering.

[0147] In one possible implementation, consider a medical triple such as "Aspirin-Purpose-Pain Relief". If the graph already has "Aspirin-Purpose-Anticoagulant", conflict detection reports attribute conflicts, validation prioritizes new data, and the extended purpose attribute is injected as a multi-valued field. Relationship paths are constructed, such as connecting to the "Heart Disease" entity. Index optimization accelerates the query for "Aspirin Purpose". This approach not only solves the consistency problem but also enhances the practical value of the graph, bringing a more reliable knowledge access experience.

[0148] This invention provides an AI Agent system based on the collaboration of a large language model and a knowledge graph, comprising: The receiving and decomposition module is used to receive user input and understand the task intent, decompose the user input into a sequence of subtasks and formulate an execution plan, the execution plan including the query of the knowledge graph and the execution order of the tools; The generation and execution module is used to generate knowledge graph query statements, execute the knowledge graph query statements and return structured subgraphs or triples; The injection output module is used to inject the structured subgraph or triples into the large language model prompt, perform information fusion, reasoning, and generate decision output; The execution module is invoked to invoke the tool executor to execute the action instructions in the decision output. The tool executor interacts with the external environment and returns the execution result. The extraction and update module is used to extract new entity relation triples from the execution result and inject the triples into the knowledge graph for updating.

[0149] The receiving and decomposition module includes: An extraction unit is used to extract key entities and relationships from user input and determine the task intent based on the key entities and relationships; A decomposition unit is used to decompose the task intent into a sequence of subtasks, and the execution plan includes the knowledge graph query order of the subtask sequence.

[0150] It should be noted that the modules provided in the embodiments of the present invention have the same implementation principle and technical effects as those in the aforementioned method embodiments. For the sake of brevity, the specific working process of the modules described above can be referred to the corresponding process in the aforementioned method embodiments, and will not be repeated here.

[0151] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the concept of this application. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. An AI Agent method based on the collaboration of a large language model and a knowledge graph, characterized in that, include: The system receives user input and understands the task intent, decomposes the user input into a sequence of subtasks, and formulates an execution plan, which includes calling knowledge graph queries and the order of tool execution. Generate a knowledge graph query statement, execute the knowledge graph query statement and return a structured subgraph or triple; The structured subgraphs or triples are injected into the large language model for information fusion, reasoning, and decision output generation; The tool executor is invoked to execute the action instructions in the decision output, and the tool executor interacts with the external environment and returns the execution result; Extract new entity relation triples from the execution results and inject the triples into the knowledge graph for updating.

2. The method as described in claim 1, characterized in that, The process of receiving user input and understanding task intent includes: Extract key entities and relationships from user input, and determine the task intent based on the key entities and relationships; The task intent is decomposed into a sequence of subtasks, and the execution plan includes the knowledge graph query order of the subtask sequence.

3. The method as described in claim 1, characterized in that, The generated knowledge graph query statement includes: The natural language problem is translated into a graph query language, which is used to specify entity paths and attribute filtering. Retrieve relevant nodes and edges using the graph query language, and return the structured subgraph or triples.

4. The method as described in claim 1, characterized in that, The step of injecting the structured subgraph or triples into a large language model for information fusion, reasoning, and generating decision output includes: The structured subgraph or triple is serialized into a text description, which is placed in front of the context of the large language model prompt. The prompt specifies that content is generated based on the structured subgraph or triple constraints, and multi-round reasoning is performed to integrate external retrieval information; The decision output is generated based on the fused information, and the decision output includes action instructions and cited facts. The large language model hints include knowledge graph pattern examples, and the injection process supports iterative queries to deepen reasoning.

5. The method as described in claim 1, characterized in that, The invocation tool executor executes the action instructions in the decision output, including: The action instructions specify the tool type and input parameters, and the tool executor handles web page searches or API calls; The tool executor returns unstructured results, and the large language model parses the unstructured results and extracts supplementary knowledge; The execution result is fed back to the large language model, which evaluates the action completion status. The tool executor generates a call sequence based on the decision output, the call sequence integrating facts returned by the knowledge graph.

6. The method as described in claim 1, characterized in that, The step of extracting new entity relation triples from the execution result includes: Use prompt words to output JSON formatted triples from the execution result text end-to-end; The triple includes subject, predicate, object, and confidence level. The large language model performs entity disambiguation to determine knowledge graph nodes.

7. The method as described in claim 1, characterized in that, The step of injecting the triples into the knowledge graph for updating includes: Before injection, conflict detection is performed on the triples, and the conflict detection compares the consistency with existing knowledge. The knowledge graph expands the entity attributes or relational paths corresponding to the triples.

8. The method as described in claim 1, characterized in that, The execution of the knowledge graph query statement and the return of the structured subgraph or triples include: Entity nodes are matched according to the graph query language, and the structured subgraph contains relation edges and attribute values; The returned results are associated with domain-specific relationships, including competitors or technical routes, and the triplet format is uniformly defined as subject, predicate, and object.

9. An AI Agent system based on the collaboration of a large language model and a knowledge graph, characterized in that, include: The receiving and decomposition module is used to receive user input and understand the task intent, decompose the user input into a sequence of subtasks and formulate an execution plan, the execution plan including the query of the knowledge graph and the execution order of the tools; The generation and execution module is used to generate knowledge graph query statements, execute the knowledge graph query statements and return structured subgraphs or triples; The injection output module is used to inject the structured subgraph or triples into the large language model prompt, perform information fusion, reasoning, and generate decision output; The execution module is invoked to invoke the tool executor to execute the action instructions in the decision output. The tool executor interacts with the external environment and returns the execution result. The extraction and update module is used to extract new entity relation triples from the execution result and inject the triples into the knowledge graph for updating.

10. The system according to claim 9, characterized in that, The receiving and decomposition module includes: An extraction unit is used to extract key entities and relationships from user input and determine the task intent based on the key entities and relationships; A decomposition unit is used to decompose the task intent into a sequence of subtasks, and the execution plan includes the knowledge graph query order of the subtask sequence.

Citation Information

Cited By

  • Intelligent agent planning enhancement method based on knowledge graph

    CN122132147A