Open vrurg opened 1 month ago
Thanks for reporting the error. Do you mind running same example with tracing enabled? so that actual payload which was failed to deserialize is printed, please also post the payload.
No problem, if I can find out how to enable it. :) I'm afraid, your help in a form of advise is needed here.
Here's an example which set up tracing and library already has code to log paylod.
https://github.com/64bit/async-openai/blob/main/examples/assistants-func-call-stream/src/main.rs#L19
(perhaps this is another opportunity for improvement where failed payload can be part of the JSONDeserialize
variant of OpenAIError
so its easily available - however that puts burden on the user to log it - logging in the library makes it available for everyone. perhaps having both can be a an option too)
I finally got time to give the tracing a try. Here is what it says:
2024-07-17T21:18:46.326525Z ERROR async_openai::error: failed deserialization of: {
"object": "list",
"data": [],
"first_id": null,
"last_id": null,
"has_more": false
}
Error: JSONDeserialize(Error("invalid type: null, expected a string", line: 4, column: 18))
Thank you for providing the error. This means that the bug is last_id
and first_id
needs to be Option
al in ListVectorStoresResponse
https://github.com/64bit/async-openai/blob/main/async-openai/src/types/vector_store.rs#L108-L109
When attempting to list vector stores of a project where no store created yet the method
list
results in:Perhaps the problem is in field
data
ofListVectorStoresResponse
is just aVec
whereas the API can return a JSONnull
for it.The proper fix would be turning the
Vec
intoOption<Vec>
, but it's a breaking change.