Could anyone lead me to a documentation reference for what’s the required format of the “metadata” field when you create an assistant?
I’ve been running the openai nodejs sdk v4.26.1 without issues but after upgrading to sdk v4.28.0, it’s failing when storing a number in the metadata field. I’m getting this error:
400 Invalid type for 'metadata.version': expected a string, but got an integer instead.
According to the sdk changelog I see no relevant changes between 4.26.1 and 4.28.0 which could cause the issue (indicating it’s a server-change). The TS description does state:
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format. Keys
* can be a maximum of 64 characters long and values can be a maxium of 512
* characters long.
metadata?: unknown | null;
…which indicate that values should be “maximum 512 characters long”, correct. In that case wouldn’t it make more sense to at least make the metadata type
metadata?: Record<string, string> | null instead?
metadata map Optional
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
This should strongly imply metadata is a string object as no other data type is described as having a maximum number of characters.
You just need to present it as
key:value pairs with string values.
Yes, I agree with you. It strongly implies it’s a string as I also mention in my post with the italic “characters” word. But I was just wondering if this “metadata” field is being used somewhere in another object, so I could see the reason for having to enfore a string. Notice the reason I at all see this as a problem is that our system broke when I did an upgrade from v4.26.1 to v4.28.0 so I’m guessing this was a recent change in the OpenAI backend and not the nodejs sdk (at least not the open-sourced version of it).
But I appreciate your answer.
I assume the reasoning for it being a string is that character objects are the richest data type (other than raw), and having all metadata being strings is far simpler.