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.