API (Application Programming Interface) documentation often only describes individual APIs and lacks information on complex API relations and code examples. Retrieval-based and generation-based methods can both produce documentation that includes API relationship descriptions and code examples. However, they are limited by the richness of available API resources. As a result, they struggle to be effective when dealing with resource-scarce languages such as Kotlin. We propose an on-demand API tutorial generation method for resource-scarce languages, transferring API knowledge from a resource-rich language like Java to Kotlin using an AI chain. Evaluating our method on 500 Kotlin APIs, we generated more API documents than the state-of-the-art retrieval-based method ADECK and the generate-based method gDoc. The number of API guidelines generated by our method is 37 times that of ADECK and 1.6 times that of gDoc. Compared with the scheme that did not adopt the knowledge transfer strategy, the success rate of our method has increased by 31.25 percentage points. This demonstrates the feasibility and potential of using LLMs to create new API knowledge across languages.
A Fri, study studied this question.