Skip to main navigation Skip to search Skip to main content

LLM-based API Argument Completion with Knowledge-Augmented Prompts

  • Waseem Akram
  • , Yanjie Jiang*
  • , Haris Ali Khan
  • , Furqan Jalil
  • , Hui Liu
  • *Corresponding author for this work
  • Beijing Institute of Technology
  • COMSATS University Islamabad
  • Tianjin University

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution › peer-review

Abstract

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.

Original languageEnglish
Title of host publicationProceedings - 2026 IEEE/ACM 48th International Conference on Software Engineering, ICSE 2026
PublisherAssociation for Computing Machinery, Inc
Pages881-893
Number of pages13
ISBN (Electronic)9798400720253
DOIs
Publication statusPublished - 11 Sept 2026
Externally publishedYes
Event48th International Conference on Software Engineering, ICSE 2026 - Rio de Janeiro, Brazil
Duration: 12 Apr 2026 → 18 Apr 2026

Publication series

NameProceedings - 2026 IEEE/ACM 48th International Conference on Software Engineering, ICSE 2026

Conference

Conference48th International Conference on Software Engineering, ICSE 2026
Country/TerritoryBrazil
CityRio de Janeiro
Period12/04/26 → 18/04/26

Keywords

  • API
  • Code Completion
  • Knowledge Graph
  • LLM

Fingerprint

Dive into the research topics of 'LLM-based API Argument Completion with Knowledge-Augmented Prompts'. Together they form a unique fingerprint.

Cite this