fix build failures: haskell streaming with withResponse, java-openai 4.3.0 with proper API, go-openai fixes, mojo real container
This commit is contained in:
parent
d5c443fbdb
commit
60b61b5a7e
11 changed files with 91 additions and 159 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import com.openai.client.OpenAIClient;
|
||||
import com.openai.client.okhttp.OpenAIOkHttpClient;
|
||||
import com.openai.models.*;
|
||||
import com.openai.models.chat.completions.ChatCompletion;
|
||||
import com.openai.models.chat.completions.ChatCompletionCreateParams;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -8,8 +9,6 @@ import java.net.URI;
|
|||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
|
@ -65,14 +64,7 @@ public class uncloseai {
|
|||
|
||||
ChatCompletionCreateParams params1 = ChatCompletionCreateParams.builder()
|
||||
.model(model1Id)
|
||||
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
|
||||
ChatCompletionUserMessageParam.builder()
|
||||
.role(ChatCompletionUserMessageParam.Role.USER)
|
||||
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
|
||||
"Give a Python Fizzbuzz solution in one line of code?"
|
||||
))
|
||||
.build()
|
||||
))
|
||||
.addUserMessage("Give a Python Fizzbuzz solution in one line of code?")
|
||||
.temperature(0.5)
|
||||
.maxTokens(150L)
|
||||
.build();
|
||||
|
|
@ -84,14 +76,7 @@ public class uncloseai {
|
|||
System.out.println("=== Streaming Chat (Model 1) ===");
|
||||
ChatCompletionCreateParams streamParams1 = ChatCompletionCreateParams.builder()
|
||||
.model(model1Id)
|
||||
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
|
||||
ChatCompletionUserMessageParam.builder()
|
||||
.role(ChatCompletionUserMessageParam.Role.USER)
|
||||
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
|
||||
"Explain quantum entanglement in one sentence."
|
||||
))
|
||||
.build()
|
||||
))
|
||||
.addUserMessage("Explain quantum entanglement in one sentence.")
|
||||
.temperature(0.5)
|
||||
.maxTokens(150L)
|
||||
.build();
|
||||
|
|
@ -113,14 +98,7 @@ public class uncloseai {
|
|||
|
||||
ChatCompletionCreateParams params2 = ChatCompletionCreateParams.builder()
|
||||
.model(model2Id)
|
||||
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
|
||||
ChatCompletionUserMessageParam.builder()
|
||||
.role(ChatCompletionUserMessageParam.Role.USER)
|
||||
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
|
||||
"Write a JavaScript function to check if a number is prime"
|
||||
))
|
||||
.build()
|
||||
))
|
||||
.addUserMessage("Write a JavaScript function to check if a number is prime")
|
||||
.temperature(0.5)
|
||||
.maxTokens(150L)
|
||||
.build();
|
||||
|
|
@ -132,14 +110,7 @@ public class uncloseai {
|
|||
System.out.println("=== Streaming Chat (Model 2) ===");
|
||||
ChatCompletionCreateParams streamParams2 = ChatCompletionCreateParams.builder()
|
||||
.model(model2Id)
|
||||
.addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(
|
||||
ChatCompletionUserMessageParam.builder()
|
||||
.role(ChatCompletionUserMessageParam.Role.USER)
|
||||
.content(ChatCompletionUserMessageParam.Content.ofTextContent(
|
||||
"Give a Python Fizzbuzz solution in one line of code?"
|
||||
))
|
||||
.build()
|
||||
))
|
||||
.addUserMessage("Give a Python Fizzbuzz solution in one line of code?")
|
||||
.temperature(0.5)
|
||||
.maxTokens(150L)
|
||||
.build();
|
||||
|
|
@ -152,9 +123,9 @@ public class uncloseai {
|
|||
});
|
||||
System.out.println("\n");
|
||||
|
||||
// TTS example - not supported in openai-java 0.8.1
|
||||
// TTS example
|
||||
System.out.println("=== TTS Speech Generation ===");
|
||||
System.out.println("[SKIPPED] TTS not available in openai-java SDK 0.8.1\n");
|
||||
System.out.println("[SKIPPED] TTS implementation needs audio API research\n");
|
||||
|
||||
System.out.println("=== Examples Complete ===");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue