Prompt enhance API recommendation: visualize the user's real intention behind this query
Yong Wang,Linjun Chen,Cuiyun Gao,Yingtao Fang,Yong Li
DOI: https://doi.org/10.1007/s10515-024-00425-0
IF: 1.677
2024-03-13
Automated Software Engineering
Abstract:Developers frequently rely on APIs in their daily programming tasks, as APIs have become an indispensable tool for program development. However, with a vast number of open-source libraries available, selecting the appropriate API quickly can be a common challenge for programmers. Previous research on API recommendation primarily focused on designing better approaches to interpret user input. However, in practical applications, it is often difficult for users, especially novice programmers, to express their real intentions due to the limitations of language expression and programming capabilities. To address this issue, this paper introduces PTAPI, an approach that visualizes the user's real intentions based on their query to enhance recommendation performance. Firstly, PTAPI identifies the prompt template from Stack Overflow (SO) posts based on the user's input. Secondly, the obtained prompt template is combined with the user's input to generate a new question. Finally, the newly generated question leverages dual information sources from SO posts and API official documentation to provide recommendations. To evaluate the effectiveness of PTAPI, we conducted experiments at both the class-level and method-level. The experimental results demonstrate the effectiveness of the proposed approach, with a significant improvement in the success rate.
computer science, software engineering