simple-openai icon indicating copy to clipboard operation
simple-openai copied to clipboard

Make `ChatRequest` and `ChatResponse` object Jackson serde compatible.

Open onhachoe opened this issue 9 months ago • 1 comments

Hi,

I want to cache OpenAI request/response pairs, and being able to serialize/deserialize these object natively using Jackson would be very helpful.

Ideally, we should be able to do

new ObjectMapper().readValue(cachedRequest, ChatRequest.class);

which currently fails with

Cannot construct instance of `io.github.sashirestela.openai.domain.chat.ChatRequest` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

Thanks,

onhachoe avatar May 09 '24 20:05 onhachoe