Coder Social home page Coder Social logo

Failed to deserialized about async-openai HOT 8 CLOSED

64bit avatar 64bit commented on June 19, 2024
Failed to deserialized

from async-openai.

Comments (8)

mhuang74 avatar mhuang74 commented on June 19, 2024 1

I ran into someting similar, and adding retries (with exponential backoff) solved my problems.

from async-openai.

mhuang74 avatar mhuang74 commented on June 19, 2024 1

from async-openai.

64bit avatar 64bit commented on June 19, 2024

Hi @federico123579,

It seems that OpenAI API responding with no value where Rust deserializtion was expecting it for one the response types in types.rs. So we might have to change response type to accept Option<T> instead.

Can you provide info about which API call is it?

from async-openai.

federico123579 avatar federico123579 commented on June 19, 2024

Sure, it happened multiple times with a CreateChatCompletionRequest (request_args) sent on client.chat().create(request_args).await.

from async-openai.

64bit avatar 64bit commented on June 19, 2024

Thank you, it seems CreateChatCompletionResponse is correctly reflecting openapi spec.
However, looking at the response example here https://platform.openai.com/docs/api-reference/chat/create suggest that model field could be optional.

Also, Chat API is currently in beta, so hard to find a solution here.

What I'm thinking is to update OpenAIError::JSONDeserialize to include actual payload returned by API to make it easy to surface invalid response.

from async-openai.

64bit avatar 64bit commented on June 19, 2024

As a first step, I have added tracing::error!( ... ) calls to log actual payload when derserialization fails, that way we get more visibility into what OpenAI is responding with. #62

Please give v0.10.1 a try, you might have to setup the tracing_subscriber to log the errors.

from async-openai.

64bit avatar 64bit commented on June 19, 2024

That's strange, the library doesnt retry after deserialization errors, one example:
https://github.com/64bit/async-openai/blob/main/async-openai/src/client.rs#L288-L290

from async-openai.

64bit avatar 64bit commented on June 19, 2024

Closing this, hopefully no longer an issue. Please reopen with additional info with debug logs if needed.

from async-openai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.