用数据库优化API规范存储,提升大模型自动修复REST API错误的能力
Database-Augmented RAG for Automated Repair of REST API Misuses

- 将API规范按版本和内容类型分库存储,增强检索准确性
- 相比基线方法,修复率从54.3%提升至88.6%
- 适合需要自动化修复API调用错误的开发者与工具集成
众多物联网服务提供代表式状态传递(REST)API,客户端开发者需根据API规范实现应用。当客户端程序存在API误用时,开发者依赖错误响应进行调试,但此类响应常不足以定位根本原因,需反复与服务器交互。检索增强生成(RAG)是为大语言模型(LLMs)提供外部知识的有前景方法。然而,在自动化修复REST API误用方面,尚未明确如何在RAG数据库中组织规范。本研究评估了不同组织方式对RAG修复效果的影响,构建了11种不同数据库结构的RAG配置,并与基线方法对比。使用真实代码仓库中的REST API误用案例进行评估。结果表明,在所研究数据集中,基线方法修复率为54.3%,而采用四个数据库的RAG方法最高达到88.6%的修复率。这表明按版本和内容类型组织规范可有效提升RAG在修复REST API误用中的表现。
原文摘要 · Abstract (English)
Many Internet of Things (IoT) services provide Representational State Transfer (REST) APIs, which require client developers to implement applications that conform to the corresponding API specifications. When client programs contain API misuse, developers debug them based on error responses. However, such responses are often insufficient for identifying the root cause, requiring developers to repeatedly communicate with the server. Retrieval-Augmented Generation (RAG) is a promising approach for providing large language models (LLMs) with external knowledge. However, in automated repair of REST API misuses, it remains unclear how specifications should be stored in a RAG database. This study evaluates how different configurations for organizing API specifications affect RAG-based repair of REST API misuse. We constructed 11 RAG configurations with different database structures and compared their repair rates with a baseline method. For evaluation, we used REST API misuse cases collected from real-world repositories. The results show that, in the studied datasets, the baseline method achieved a repair rate of 54.3%, whereas a RAG-based method using four databases achieved a maximum repair rate of 88.6%. These results indicate that organizing specifications according to version and content type can be an effective design choice for RAG-based REST API misuse repair.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。