openai-java
openai-java copied to clipboard
OpenAI Api Client in Java
api/build.gradle: compileOnly 'org.projectlombok:lombok:1.18.12' * What went wrong: Execution failed for task ':api:compileJava'. > java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x241019f1) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler...
When only using Maven, not Gradle, api and client both use com.theokanning.openai as the package name, and so maven cannot build as the error `module [X] reads package com.theokanning.openai from...
In the docs, you have this request example ([[here](https://beta.openai.com/docs/api-reference/completions/create)]): ```{ "model": "text-davinci-002", "prompt": "Say this is a test", "max_tokens": 6, "temperature": 0, "top_p": 1, "n": 1, "stream": false, "logprobs": null,...
```java /** Use {@link OpenAiService#createCompletion(CompletionRequest)} and {@link CompletionRequest#model}instead */ @Deprecated public CompletionResult createCompletion(String engineId, CompletionRequest request) ``` The example in the readme uses the old completion, which should be updated...
``` package net.Amogh; import com.theokanning.openai.OpenAiService; import com.theokanning.openai.completion.CompletionRequest; public class Main { public static void main(String[] args){ OpenAiService service = new OpenAiService("token here"); CompletionRequest completionRequest = CompletionRequest.builder() .prompt("Hi") .echo(true) .build(); service.createCompletion(completionRequest).getChoices().forEach(System.out::println);...
…r in Image and Completion Requests For developers that don't use the client library. Example was made with RestTemplate. EX. ERROR: org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "{ "error": { "message": "Unrecognized...
如何联系上下文?

- Check if the value of token, url and timeout is null and return if they are null - Check if the value of timeout is negative, if it's negative...
The official documentation has an example in python: https://platform.openai.com/docs/guides/embeddings. I am not seeing how this great Java library could help achiece the same, especially this line: `` df['similarities'] = df.ada_embedding.apply(lambda...
 console print: Exception in thread "main" retrofit2.adapter.rxjava2.HttpException: HTTP 401 Unauthorized at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57) at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38) at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48) at io.reactivex.Observable.subscribe(Observable.java:12284) at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35) at io.reactivex.Observable.subscribe(Observable.java:12284) at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35) at io.reactivex.Single.subscribe(Single.java:3666)...