Response Filtering for Actions

I’ve been mucking around with creating an action so that I can load information from GitHub (have to supply my API key). This seems to work decently.
However, large responses are an issue. GitHub really likes including extra API endpoints in their response, which bloats it considerably.
(See their docs for examples)

I ran into this when testing via asking it to find a specific repository on my account. The default page limit is 30, and so that went over the request size limit.
Github, unfortunately, does not have a way to filter out those fields.

The second issue is that Github’s API returns file contents encoded as base64. This makes sense for binary files, and it is trivial to instruct ChatGPT to decode it with the code interpreter.
Unfortunately, this is slow as it has to output each base64 token that it got from the response.

The only full solution to both of these for me is to setup a proxy-api, but that is annoying and means that the action is less useful for other users (I don’t want to be hosting a full API server for everyone).

One solution that would fix both of these problems and add more power to actions is to let us include predefined (simple) python scripts that are ran with the (preparsed?) content of the response. Then we could return more JSON, or literal text.

Benefits:

  • Get responses faster, since we don’t have to wait for ChatGPT to spit the file content back out
  • Lets us transform the content into a more natural form for ChatGPT. Most code file content isn’t written with the literal ‘\n’ characters included in it, but rather with normal newlines.
  • Possibly avoid ‘response too large’ limits, or lets them be raised because ChatGPT wouldn’t have to directly process large token output?
  • Would allow strict programmatic behavior. So if we want to have a script convert the format automatically (like the base64 transformation, but it could also be things like lightweight decompression which isn’t too rare in APIs) or do things like provide some information automatically.
1 Like

Are you using the GitHub endpoints directly or some middleware? If you’re not I would use middleware so you can parse the data before returning it to ChatGPT.

There are also some 3rd-party websites like Zapier (no affiliation) that are already set up to integrate ChatGPT with external APIs.

Although, of course your request was fair. Just preempting you may not know about the middleware option.