Application/json; charset=utf-8 in openapi schema leads to UnrecognizedKwargsError

I have been trying out the poem-openapi Rust crate for a ChatGPT plugin backend, as an alternative to my familiar Python FastAPI stack. When I used it’s derive(Object) on a struct and included that as the body of a POST endpoint, it generated an OpenAPI schema that had a paths section with an application/json; charset=utf-8 media type. Relevant poem-openapi code. Example openapi json snippet:

{"paths": {
  "/foo": {
    "post": {
      "requestBody": {
        "content": {
          "application/json; charset=utf-8": {
            "schema": {
              "$ref": "#/components/schemas/FooRequest"
}}}}}}},

  components": {
    "schemas": {
      "FooRequest": {
        "type": "object",
        "required": [
          "path"
        ],
        "properties": {
          "path": {
            "type": "string",
            "default": "."
  }}}}}
}

When ChatGPT tried to POST to that endpoint with any body, it failed to send any traffic over the network and instead showed the response as “ERROR: UnrecognizedKwargsError: path”. That error has at least one thread of its own. Copying out the poem-openapi generate OpenAPI spec and serving it out from a flat file, editing the content type to just be application/json instead of application/json; charset=utf-8, fixed the issue.

A google search for “openapi client generator application/json charset utf-8” does point to a few different bug issues, mostly resolved. Is this a bug in OpenAI / ChatGPT’s plugin client code?

1 Like

Easy solution:

Try out Recombinant AI on the plugin store:

install and say “Start RAI”.

Either enter 7 or “Guided Tour” or 4/ “Projects” to get started , then follow the prompt and enter “OpenAI/plugins-QuickStart” along with your desired functionality. Or enter the Owner/Reponame of your codebase and ask it to fix it.

Harder solution:

Please go back and take a look at the OpenAPI specs from the ChatGPT plugin documentation. This doesn’t follow the formatting laid out there.

You need an operation ID, descriptions for your endpoints (!!! This is the only way Chat knows what they do!!!). I’ve also haven’t seen anyone need to utf-8 the content in the spec?

The components don’t look right either. You don’t define any objects of the Request in the schema.

If this is your first plugin, it’s way easier to stick to the templates OpenAI has given.

Hello @GlassAcres . This is not my first plugin, I’m one of the developers of the popular Noteable plugin as well. The partial OpenAPI spec snippet I posted was only to highlight that the addition of charset=utf-8 leads to the error.

If you take one of your own plugins and modify its OpenAPI spec to add charset=utf-8 in the appropriate spot, I believe you’ll be able to reproduce this error. It would be great to hear if my diagnosis about the root cause is right or not.

1 Like

Gotcha! I’ll give it a try as well.

1 Like

Moved to API Bugs for visibility .

1 Like