Use ChatGPT with Recently Released APIs
ChatGPT’s knowledge cut-off date is before the creation of new APIs you might want to use, so as a library author, you may want to document your API in an AI-friendly way. Even existing libraries can benefit from this technique because ChatGPT is less likely to hallucinate when presented with concrete API examples. This solution will work for any API, old or new.
Before we get into examples, here’s a brief description of the process.
-
Write a concise example program that exercises the API you want to teach ChatGPT. (In my case, the parts you’d use in the first five minutes of a new application.)
-
Strip all the human-friendly nonsense out of your code; it should be as short as possible while still being runnable.
-
Paste your example code to ChatGPT and ask it to write an app using your API.
How you describe the app to build might be the most important part—the less you leave to chance, the better.
Let’s go through those steps with Fireproof, a new database designed to be especially well-suited to development with ChatGPT because you can write complete apps before you have to configure anything or sign up for any services.
- 1. Write an illustrative example.
-
Here is a concise example program that exercises the Fireproof API—it is designed to show the call points a developer needs to know about, and nothing more. ChatGPT is especially good at learning by omission, so the ...
Get Use ChatGPT with Recently Released APIs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.