LLM-based API Argument Completion with Knowledge-Augmented Prompts
Waseem Akram, Yanjie Jiang, Haris Ali Khan, Furqan Jalil, Hui Liu
摘要
Application Programming Interfaces (APIs) are fundamental to modern software development, yet accurately completing API method arguments remains a challenging task. Existing methods, such as information retrieval and hybrid program analysis with language models, often struggle with static code patterns and limited domain-specific knowledge. To this end, in this paper, we introduce APICopilot, a novel approach that enhances LLM-based API argument completion using dynamically generated, context-rich prompts. First, it creates an input knowledge graph (KG) from the preceding code for the to-be-complete API invocation, and a targeted knowledge graph from a collection of similar code files, both representing the anticipated API call. Second, it quantifies structural and semantic alignment between the two KGs and retrieves relevant subgraphs from the targeted graph. These subgraphs provide crucial structural context for in-context learning, enabling significantly more accurate and context-specific argument completions. Finally, we integrate the subgraphs into prompts and request LLMs to recommend API arguments. Our evaluation results on 54,000 Java files suggest that the proposed approach outperforms the state-of-the-art approach, improving precision, recall, and mean reciprocal rank by 38%, 36% and 23%, respectively.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
相关 Paper
- What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and BeyondWenchao Gu, Juntao Chen, Yanlin Wang, Tianyue Jiang 等ICSE 2026 · 被引用 1 次
- Knowledge-Enhanced Program Repair for Data Science CodeShuyin Ouyang, Jie M. Zhang, Zeyu Sun, Albert Meroño-PeñuelaICSE 2025 · 被引用 2 次
- LLM-Based Method Name Suggestion with Automatically Generated Context-Rich PromptsWaseem Akram, Yanjie Jiang, Yuxia Zhang, Haris Ali Khan 等FSE 2025 · 被引用 1 次
- Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program RepairYuxiang Wei, Chunqiu Steven Xia, Lingming ZhangFSE 2023 · 被引用 111 次
- ReproCopilot: LLM-Driven Failure Reproduction with Dynamic RefinementTanakorn Leesatapornwongsa, Fazle Elahi Faisal, Suman NathFSE 2025
