Skip to content

Commit

Permalink
build: 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Mar 15, 2023
1 parent ba37868 commit dfd9cad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "xyz.cssxsh.mirai"
version = "1.2.3"
version = "1.3.0"

mavenCentralPublish {
useCentralS01()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public object MiraiOpenAiPlugin : KotlinPlugin(
JvmPluginDescription(
id = "xyz.cssxsh.mirai.plugin.mirai-openai-plugin",
name = "mirai-openai-plugin",
version = "1.2.3",
version = "1.3.0",
) {
author("cssxsh")
}
Expand Down
17 changes: 17 additions & 0 deletions src/test/kotlin/xyz/cssxsh/openai/OpenAiClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xyz.cssxsh.openai

import kotlinx.coroutines.*
import org.junit.jupiter.api.*
import org.junit.jupiter.api.condition.*
import xyz.cssxsh.openai.image.*

internal class OpenAiClientTest {
Expand All @@ -26,6 +27,7 @@ internal class OpenAiClientTest {
}

@Test
@EnabledIfEnvironmentVariable(named = "CI", matches = "true")
fun completions(): Unit = runBlocking {
val model = "text-davinci-003"
val completion = client.completion.create(model) {
Expand All @@ -52,4 +54,19 @@ internal class OpenAiClientTest {
fun files(): Unit = runBlocking {
val files = client.file.list()
}

@Test
@EnabledIfEnvironmentVariable(named = "CI", matches = "true")
fun chat(): Unit = runBlocking {
val model = "gpt-3.5-turbo-0301"
val chat = client.chat.create(model) {
messages {
user(content = "Hello!")
}
}

Assertions.assertEquals(model, chat.model)
Assertions.assertFalse(chat.choices.isEmpty())
Assertions.assertNotNull(chat.choices.first().message)
}
}

0 comments on commit dfd9cad

Please sign in to comment.