Class OpenAiRestApi.OpenAiRestApiJacksonReader

java.lang.Object
org.jboss.resteasy.reactive.common.providers.serialisers.AbstractJsonMessageBodyReader
io.quarkiverse.langchain4j.openai.common.OpenAiRestApi.OpenAiRestApiJacksonReader
All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<Object>
Enclosing interface:
OpenAiRestApi

@Priority(4900) public static class OpenAiRestApi.OpenAiRestApiJacksonReader extends org.jboss.resteasy.reactive.common.providers.serialisers.AbstractJsonMessageBodyReader
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
    Normally this is not necessary, but if one uses the 'demo' LangChain4j key, then the response comes back as type text/html but the content is still JSON.
    readFrom(Class<Object> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream)
    We need a custom version of the Jackson provider because reading SSE values does not work properly with @ClientObjectMapper due to the lack of a complete context in those requests

    Methods inherited from class org.jboss.resteasy.reactive.common.providers.serialisers.AbstractJsonMessageBodyReader

    isReadable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenAiRestApiJacksonReader

      public OpenAiRestApiJacksonReader()
  • Method Details

    • isReadable

      public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType)
      Normally this is not necessary, but if one uses the 'demo' LangChain4j key, then the response comes back as type text/html but the content is still JSON.
      Specified by:
      isReadable in interface jakarta.ws.rs.ext.MessageBodyReader<Object>
      Overrides:
      isReadable in class org.jboss.resteasy.reactive.common.providers.serialisers.AbstractJsonMessageBodyReader
    • readFrom

      public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException
      We need a custom version of the Jackson provider because reading SSE values does not work properly with @ClientObjectMapper due to the lack of a complete context in those requests
      Throws:
      IOException
      jakarta.ws.rs.WebApplicationException