UnrecognizedKwargsError error

I’m getting this dreaded " UnrecognizedKwargsError error"

I have tried to debug this to no avail, scenario is the following, building a retrieval plugin based on ChromaDB, basic operation works OK, but applying advanced operations for filtering is giving me a nightmare since yesterday!

Here is the relevant portion while trying to add an item to a collection

components:

    AddItemInput:
      type: object
      properties:
        collection_name:
          type: string
          description: The name of the collection to which the item(s) will be added.
        documents:
          type: array
          items:
            type: string
          description: A list of documents to be added to the specified collection.
        embeddings:
          type: array
          items:
            type: array
            items:
              type: number
          description: A list of embeddings corresponding to the documents being added. Optional.
        metadatas:
          type: array
          items:
            type: object
          description: A list of metadatas dictionaries corresponding to the documents being added. Optional.
        ids:
          type: array
          items:
            type: string
          description: A list of unique identifiers for the documents being added. Required.

paths:

 /add_item:
    post:
      operationId: addItem
      summary: Add an item to a collection
      description: This endpoint adds an item to a specified collection in the ChromaDB. The input data includes the collection name, documents, embeddings, metadatas, and IDs.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddItemInput'
          example:
            {"collection_name": "articles", "documents": ["The quick brown fox jumps over the lazy dog."], "embeddings": [[0.1, 0.2, 0.3]], "metadatas": [{"author": "Alice", "category": "Nature"}], "ids": ["doc1"]}
      responses:
        '200':

Here is the problem, whenever the plugin calls into the API, it throw this error and suggestion:
"
UnrecognizedKwargsError: metadatas

It seems that the “metadatas” argument is not recognized by the addItem endpoint. To store metadata along with the document, we need to include the metadata within the document itself. Let’s modify the document structure to include the metadata and try again.
"
The request never hit my local webserver so I don’t know what’s going on.
it keeps trying until eventually it removes the metadatas completely and only keeps the ids and documents, and then send it to the API and it succeeds.

When it parse my language to come up with the required inputs it seems to get it right as per the output of the plugin on the screen:

{
  "collection_name": "articles",
  "documents": [
    "The quick brown fox is very fast."
  ],
  "ids": [
    "doc1"
  ],
  "metadatas": [
    {
      "author": "Alice",
      "category": "Animals"
    }
  ]
}

But for somehow something seems wrong and it never able to send with the metadatas.

Anyone has any suggesstion how to debug this further, I tried peeking at the debugging tools in chrome but with no luck to figure it out so far.

Thanks.

I reported the same bug a week or two ago. It is not your fault; it’s a bug. And OpenAI has not seemingly even taken a look at it.

2 Likes

I’ve just stumbled into this and after checking the example repo it seems that you need to explicitly specify the parameters that are going to be passed to each of the plugin’s API endpoints.

This is not very clear on the documentation, specially on the openapi.yaml definition part of it.

From the example repo:

/todos/{username}:
    get:
      operationId: getTodos
      summary: Get the list of todos
      parameters:
      - in: path
        name: username
        schema:
            type: string
        required: true
        description: The name of the user.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTodosResponse'

When you say “explicitly specify the parameters”, what do you mean by “parameters”? In my openapi.yaml, I definitely have specified the parameters.

I can’t be 100% positive but I believe the issue comes from this kind of properties:

           items:
            type: object
          description: A list of metadatas dictionaries corresponding to the documents being added. Optional.

It seems ChatGPT does not like “object” that don’t explicitly define their properties. I don’t know the reason, but all our customers at pluginlab.ai reported the same issue actually.

Like in my case, I was getting:

UnrecognizedKwargsError: ('query')

When I added the query parameter inside parameters (like below) it worked:

paths:
  /api/query:
    get:
      operationId: query
      summary: Generates a query based on the user input. Database interaction will be handled on plugin side.
      parameters:
      - in: query
        name: query
        schema:
            type: string
        required: true
        description: The query to be sent to the API endpoint.