We are experimenting a lot at Blobr with plugins and managed to connect a lot of tool we use internally like hubspot, notion, typeform, etc. It is fascinating that you can request any SaaS in ChatGPT directly.
We had the following key learnings:
An API product approach with fewer Calls, More Arguments
When designing your API, it’s often more effective to have fewer endpoints with more query parameters. The golden number seems to be about 3 or 4 endpoints max. This approach simplifies the API and makes it easier for the ChatGPT plugin to understand and interact with. For example, instead of having separate endpoints for stories, comments, polls, etc., you could have a single /items endpoint with various query parameters to control the output.
Learn by Iteration
Sometimes, ChatGPT might “hallucinate” parameters that don’t exist in your API. Instead of seeing this as a problem, consider it as a hint for potential improvements. For instance, if ChatGPT frequently adds a non-existent sort_order parameter, it might be a good idea to implement it. Iterating your API based on these insights can lead to a more effective integration.
Be Terse
Both your OpenAPI specification and your API responses should be as concise as possible. While it’s important to be descriptive, short and to-the-point descriptions tend to work better with ChatGPT. Also, if your API responses are too long, it might lead to hallucinations or the model ignoring your response. So, keep it short and sweet!
Be Tolerant of Inputs
ChatGPT is a language-driven model and might not be as precise with numbers as a human user would be. Therefore, it’s a good idea to avoid things like UNIX timestamps in your APIs. Instead, use standardized date formats like ISO8601, or even better, accept natural language inputs. Using parsers like dateparser in Python can help process natural language dates and times.
Set Reasonable Defaults
Setting reasonable default values for your endpoints can improve the user experience. For instance, if you have a limit parameter for the /items endpoint, consider setting a default value that provides a balance between response length and usefulness.
Use ChatGPT to Help You
ChatGPT can be a valuable tool in the development of your API. Not only can it help write code for your API implementation, but it can also create concise descriptions of APIs from lengthy documentation. This can be a great starting point for your project.
What are your key learnings creating your plugins?