Javadocs for /answers

Is there a way to easily use the following javadocs as the documents for /answers?

https://javadoc.io/doc/org.firstinspires.ftc/RobotCore/latest/index.html

It is doable but you will need to get creative and implement your own /code-answers API by combining search and completion APIs.

The main challenges I see are -

  1. Parse and segregate the Javadoc in very meaningful chunks so we can do semantic search on it.
  2. The /search API returns minimum amount of context from the file you provided. You will need to have very meaningful segregations of the document dataset and add enough metadata so you can retrieve it separately for the completion.
  3. The completion API is limited in terms of # of tokens you can pass in. Assuming we want to generate code, so we will first need to figure out the right references of the Javadoc are passed in and have enough room for the code generation, all these need to be done within 4096 tokens. So some level of summarization could be needed for the Javadoc context in the completion. Also we currently don’t have a way to fine-tune codex models so if we can have that it would be great.

Hope this helps. I am also experimenting /answers lately and about to build a /super-answers endpoint myself :smiley:

@simonl What I’ve been doing is using the /answers endpoint with cushman-codex and davinci codex as the search and completion engines.

One thing that has been helping me understand how /answers works is to turn on the return_prompt flag. You will find whether or not your javadoc is fetched properly by the search request. What I noticed during the experiment is that the search request actually only scans and retrieves the relevant line from the document as context. So if your document has a lot of line breaks, it is likely going to have issues. Considering the nature of source code, you will definitely want to look into how to build your own /code-answers endpoint. I don’t see any test results on your end so that’s all I can give for suggestion.

1 Like