Developers' API needs should be more pragmatic, such as seeking suggestive, explainable, and extensible APIs rather than the so-called best result. Existing API search research cannot meet these pragmatic needs because they are solely concerned with query-API relevance. This necessitates a focus on enhancing the entire query process, from query definition to query refinement through intent clarification to query results promoting divergent thinking about results. This paper designs a novel Knowledge-Aware Human-AI Dialog agent (KAHAID) which guides the developer to clarify the uncertain, under-specified query through multi-round question answering and recommends APIs for the clarified query with relevance explanation and extended suggestions (e.g., alternative, collaborating or opposite-function APIs). We systematically evaluate KAHAID. In terms of human-AI dialogue efficiency, it achieves a high diversity of question options and the ability to guide developers to find APIs using fewer dialogue rounds. For API recommendation, KAHAID achieves an MRR and MAP of 0.769 and 0.794, outperforming state-of-the-art methods BIKER and CLEAR by at least 47% in MRR and 226.7% in MAP. For knowledge extension, KAHAID obtains an MRR and MAP of 0.815 and 0.864, surpassing ZaCQ by at least 42% in MRR and 45.2\% in MAP. Furthermore, we conduct a user study. It shows that explainable API recommendations, as implemented by KAHAID, can help developers identify the best API approach more easily or confidently, improving inspiration of clarification question options by at least 20.83% and the extensibility of extended APIs by at least 12.5%.
翻译:开发者的API需求应更具实用性,例如寻求具有建议性、可解释性和可扩展性的API,而非所谓的“最佳结果”。现有API搜索研究仅关注查询与API的相关性,无法满足这些实用需求。因此,必须聚焦于优化整个查询过程——从查询定义、通过意图澄清进行查询精化,到查询结果促进发散性思维。本文设计了一种新颖的知识感知人机对话代理(KAHAID),该代理通过多轮问答引导开发者澄清不确定、欠规范的查询,并为精化后的查询推荐API,同时提供相关性解释和扩展建议(例如替代、协作或功能相反的API)。我们对KAHAID进行了系统评估。在人机对话效率方面,其实现了高多样性的问答选项,并能以更少的对话轮次引导开发者找到API。在API推荐方面,KAHAID的MRR和MAP分别达到0.769和0.794,相较于现有最优方法BIKER和CLEAR,MRR提升至少47%,MAP提升至少226.7%。在知识扩展方面,KAHAID的MRR和MAP分别达到0.815和0.864,相较于ZaCQ,MRR提升至少42%,MAP提升至少45.2%。此外,我们还进行了用户研究。结果表明,KAHAID实现的可解释API推荐能帮助开发者更轻松或更自信地识别最佳API方案,使精化问答选项的启发性提升至少20.83%,扩展API的可扩展性提升至少12.5%。