Enhancing the capabilities of large language models for API calls through knowledge graphs
摘要
API calls by large language model (LLM) represent a cutting-edge technique in data analysis. However, the potential of LLM to effectively utilize tools through API calls remains underexplored in knowledge-intensive sectors such as the meteorological industry. In this paper, we propose a system, named KG2data, that integrates knowledge graphs, LLM, React agents, and tool usage technologies to perform API calls for intelligent data acquisition and query handling in the meteorological domain. We test the accuracy of the system’s API calls using a virtual API. The baseline systems for comparison are chat2data (KG2data without knowledge) and RAG2data (KG2data with a vector database replacing the knowledge graph). Our experimental results demonstrate that the proposed system (1.43%, 0% and 88.57% in 3 evaluation metrics) outperforms RAG2data (16%, 10% and 72.14% in 3 evaluation metrics) and chat2data (7.14%, 8.57% and 71.43% in 3 evaluation metrics) in terms of failure rate of name recognition, failure rate of hallucination recognition and accuracy rate for API calls. Our system integrates knowledge graph, LLM, and ReAct-master agent technologies. Unlike current LLM used for API calls, our system overcomes the challenge of limited domain-specific knowledge of LLM, which often makes it difficult to address complex queries containing specialized terminology or lengthy questions. By utilizing knowledge graphs as long-term memory, our system significantly improves conten-retrieval coverage, handling of complex queries, industry-specific logical reasoning, deep semantic relationships among entities, and the integration of heterogeneous data. Additionally, it addresses the high computational costs associated with training or fine-tuning LLM, making it more adaptable to the dynamic nature of domain knowledge and APIs. In summary, the KG2data system offers a fresh perspective for intelligent knowledge-based question answering and data analysis in knowledge-intensive industries.