Building an AI coding assistant for the OpenAI API

I was thinking of building a quick assistant to help out with writing Python code related to the OpenAI API. I thought that instead of using the built-in retrieval tool to access the documentation and API reference, it might yield better results if I upload the documentation as PDF files or add them to a vector store and build a search tool using function calling.

Has anyone already created a similar tool to help answer questions about the OpenAI API, or is there an official way to download the documentation? Additionally, has anyone written a script to automate this or the fetching of the documentation and API refrence?

I also welcome other ideas on how to improve the functionality! I thought of maybe also adding in the OpenAI API cookbooks, but it might be better to concentrate on the documentation.

1 Like

Great idea! Did you end up doing this? Would like to try it.

I made a GPT which does exactly this. It also does a bunch of other unrelated stuff so I’m not able to share it without making a privacy policy and such.

Essentially I gave it the oenapi spec from openai-openapi/openapi.yaml at master · openai/openai-openapi · GitHub, which it’s able to understand and parse. In its instructions I explain what the file is, to ignore legacy/deprecated aspects, and its commit hash and date for the purpose of change tracking.

It works really well where you can ask it to implement the data structures and http calls for the various endpoints. The thing I need to be the most particular about is for complex types like polymorphism via oneOf definitions and such. There’s no defacto correct answer to how this should be implemented in your code, so you need to tell it how you prefer to handle it. It’s also useful to allow it to use placeholder types so that it won’t start implementing the entire schema at once.

It’s also not likely to intuit stuff like how you won’t need to deserialize request payloads and vice versa. This can lead to it trying to force out functions which don’t make sense and aren’t needed.

It’s actually not able to browse the pages at https://platform.openai.com/docs all that well since a lot of the information is tucked behind javascript. I ended up stripping out the html for certain stuff, like for assistants. Even if the resulting html has a ton of cruft it’s able to read it really well.

After pasting in the html along with uploading the openapi.yaml to its knowledge, it’s able to give me this kind of advice and summary which I find extremely useful:

Edit: I went and stripped out the openai stuff and put it in a new GPT for anyone curious. It has some issues reading the files from knowledge since I tried to make it aware of the entire API, but it’s functional if you are specific enough.

https://chat.openai.com/share/1c0cccfc-384d-4171-8c7e-aacb66b8d4c0

4 Likes

This is pretty good. Just a few more steps and you can get API keys for your agents through a fetch and screen capture system to build your own AI interfacing with your agent, but that might break OpenAI rules about using your assistant or openAI apis to train other agents… so be careful not to do anything outside of the rules.

:grinning: :grinning:
Came across this randomly just when i needed after i had bashed around by my clueless self.
Trying to develop tools for interfacing with a data API based on a python program i wrote and a gradio interface to help query. Was hoping i could then give to a GPT as tools to use, and then further get that GPT to learn to generalize an approach to accessing other data APIs.
Long story shorter… the OpenAI GPTs don’t even seem to know what openai GPTs are, instead just generalizing it to AI models with no knowledge of how to build themselves. Thought that if i could feed it OAI API docs it could learn…looks like you’ve already achieved that.

Again…wanted to say thanks. Any chance you have an open github or whatever you used to do this, or did you just feed documents to a GPT?