Contextual API Completion for Unseen Repositories Using LLMs
Not on the map. Why?
Abstract (arXiv)
Large language models have made substantial progress in addressing diverse code-related tasks. However, their adoption is hindered by inconsistencies in generating output due to the lack of real-world, domain-specific information, such as for intra-repository API calls for unseen software projects. We introduce a novel technique to mitigate hallucinations by leveraging global and local contextual information within a code repository for API completion tasks. Our approach is tailored to refine code completion tasks, with a focus on optimizing local API completions. We examine relevant import statements during API completion to derive insights into local APIs, drawing from their method signatures. For API token completion, we analyze the inline variables and correlate them with the appropriate imported modules, thereby allowing our approach to rank the most contextually relevant suggestions from the available local APIs. Further, for conversational API completion, we gather APIs that are most relevant to the developer query with a retrieval-based search across the project. We employ our tool, LANCE, within the framework of our proposed benchmark, APIEval, encompassing two different programming languages. Our evaluation yields an average accuracy of 82.6% for API token completion and 76.9% for conversational API completion tasks. On average, LANCE surpasses Copilot by 143% and 142% for API token completion and conversational API completion, respectively. The implications of our findings are substantial for developers, suggesting that our lightweight context analysis can be applied to multilingual environments without language-specific training or fine-tuning, allowing for efficient implementation with minimal examples and effort.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). First posted on arXiv 7 May 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2024: 1; 2025: 4; 2026: 1.
6 papers.
- 2025Towards an Understanding of Context Utilization in Code Intelligencecited by 10
- 2024NaviQAte: Functionality-Guided Web Application Navigationcited by 9
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
- 2026To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generationcited by 3
- 2025FalseCrashReducer: Mitigating False Positive Crashes in OSS-Fuzz-Gen Using Agentic AIcited by 2
- 2025Beyond Accuracy: Behavioral Dynamics of Agentic Multi-Hunk Repaircited by 2
- 2026To See is Not to Master: Teaching LLMs to Use Private Libraries for Code Generation16 Mar 2026
- 2025Beyond Accuracy: Behavioral Dynamics of Agentic Multi-Hunk Repair14 Nov 2025
- 2025FalseCrashReducer: Mitigating False Positive Crashes in OSS-Fuzz-Gen Using Agentic AI2 Oct 2025
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industry21 May 2025
- 2025Towards an Understanding of Context Utilization in Code Intelligence11 Apr 2025
- 2024NaviQAte: Functionality-Guided Web Application Navigation16 Sep 2024