Skip to content

Commit 9be3d3f

Browse files
committed
Merge branch 'master' into completions
2 parents 4bcd10c + 7f38791 commit 9be3d3f

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ Feel free to use, modify, and distribute this code as needed.
88
For Kotlin DSL (`build.gradle.kts`), add this to your dependencies block:
99
```kotlin
1010
dependencies {
11-
implementation("com.cjcrafter:openai:1.2.3")
11+
implementation("com.cjcrafter:openai:1.2.7")
1212
}
1313
```
1414
For Maven projects, add this to your `pom.xml` file in the `<dependencies>` block:
1515
```xml
1616
<dependency>
1717
<groupId>com.cjcrafter</groupId>
1818
<artifactId>openai</artifactId>
19-
<version>1.2.3</version>
19+
<version>1.2.7</version>
2020
</dependency>
2121
```
22-
See the [maven repository](https://central.sonatype.com/artifact/com.cjcrafter/openai/1.2.3) for gradle/ant/etc.
22+
See the [maven repository](https://central.sonatype.com/artifact/com.cjcrafter/openai/1.2.7) for gradle/ant/etc.
2323

2424

2525
# Working Example

build.gradle.kts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
22

33
group = "com.cjcrafter"
4-
version = "1.2.3"
4+
version = "1.2.7"
55

66
plugins {
77
`java-library`
@@ -25,22 +25,15 @@ dependencies {
2525
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
2626
}
2727

28-
java {
29-
toolchain {
30-
languageVersion.set(JavaLanguageVersion.of(17))
28+
kotlin {
29+
jvmToolchain {
30+
languageVersion.set(JavaLanguageVersion.of(8))
3131
}
3232
}
3333

34-
tasks {
35-
compileJava {
36-
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
37-
options.release.set(8)
38-
}
39-
javadoc {
40-
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
41-
}
42-
processResources {
43-
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
34+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
35+
kotlinOptions {
36+
jvmTarget = "1.8"
4437
}
4538
}
4639

src/test/java/JavaChatStreamTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import com.cjcrafter.openai.chat.*;
33
import io.github.cdimascio.dotenv.Dotenv;
44

5-
import java.util.ArrayList;
6-
import java.util.List;
7-
import java.util.Scanner;
5+
import java.util.*;
86

97
public class JavaChatStreamTest {
108

@@ -13,7 +11,7 @@ public static void main(String[] args) {
1311

1412
// Prepare the ChatRequest
1513
ChatMessage prompt = ChatMessage.toSystemMessage("Be as unhelpful as possible");
16-
List<ChatMessage> messages = new ArrayList<>(List.of(prompt));
14+
List<ChatMessage> messages = new ArrayList<>(Collections.singletonList(prompt));
1715
ChatRequest request = ChatRequest.builder()
1816
.model("gpt-3.5-turbo")
1917
.messages(messages).build();

src/test/java/JavaChatTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import java.io.IOException;
77
import java.util.ArrayList;
8+
import java.util.Collections;
89
import java.util.List;
910
import java.util.Scanner;
1011

@@ -19,7 +20,7 @@ public static void main(String[] args) throws OpenAIError {
1920
// Use a mutable (modifiable) list! Always! You should be reusing the
2021
// ChatRequest variable, so in order for a conversation to continue
2122
// you need to be able to modify the list.
22-
List<ChatMessage> messages = new ArrayList<>(List.of(prompt));
23+
List<ChatMessage> messages = new ArrayList<>(Collections.singletonList(prompt));
2324

2425
// ChatRequest is the request we send to OpenAI API. You can modify the
2526
// model, temperature, maxTokens, etc. This should be saved, so you can

0 commit comments

Comments
 (0)