openai4j
openai4j copied to clipboard
Java client library for OpenAI API
Fix unit tests, trigger completion callback when connection is closed, avoid NPE in client timeout
This Pull Request handles gracefully errors that can happen while using OpenAI API compatible backends, such as *predibase* and *replicate*. It also fixes some consistently failing unit tests. ## Case...
Now that OpenAI allows to upload PDFs in the prompt, I wanted to implement this feature in LangChain4j (in `InternalOpenAiHelper`), but the PDF content type is missing. So I am...
**Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] We process large amounts...
There is no documentation about ho to send Image from ByteArray or Stream... It is possible to send by url or "text"... what is a text image ?? Thank you...
**Is your feature request related to a problem? Please describe.** To use the library i need to authenticate to an proxy. The used okHttp client provides a authenticator field for...
**Describe the bug** [1be47b89-1, L:/172.31.3.161:54056 - R:api.openai.com/172.66.0.243:443] The connection observed an error org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/json' not supported for bodyType=dev.ai4j.openai4j.chat.ChatCompletionRequest at org.springframework.web.reactive.function.BodyInserters.unsupportedError(BodyInserters.java:440) ~[spring-webflux-6.1.12.jar:6.1.12] at org.springframework.web.reactive.function.BodyInserters.writeWithMessageWriters(BodyInserters.java:430) ~[spring-webflux-6.1.12.jar:6.1.12] at org.springframework.web.reactive.function.BodyInserters.lambda$fromPublisher$4(BodyInserters.java:190) ~[spring-webflux-6.1.12.jar:6.1.12] at...
Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`) at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: xxx >dev.ai4j.openai4j.chat.ChatCompletionRequest$Builder["messages"]->java.util.ArrayList[0]->dev.ai4j.openai4j.chat.UserMessage$Builder["content"]) Does json deserialization not currently supported?
1. Support customize dispatcher of okHttpClient in DefaultOpenAiClient. 2. Use custom dispatcher and validate by thread id in ChatCompletionStreamingTest.
**Is your feature request related to a problem? Please describe.** I want to use this openai client in a production environment, so the ThreadPoolExecutor which okHttpClient use should be customized...