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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 requestsMethods inherited from class org.jboss.resteasy.reactive.common.providers.serialisers.AbstractJsonMessageBodyReader
isReadable
-
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 interfacejakarta.ws.rs.ext.MessageBodyReader<Object>
- Overrides:
isReadable
in classorg.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.WebApplicationExceptionWe 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
-