Skip to content

Commit 0adbbc7

Browse files
committed
add a layer of abstraction on the OpenAI, add OpenAIImpl, cleanup
1 parent 0154f42 commit 0adbbc7

File tree

12 files changed

+281
-1097
lines changed

12 files changed

+281
-1097
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
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.3.2"
4+
version = "2.0.0"
55

66
plugins {
77
`java-library`

src/main/kotlin/com/cjcrafter/openai/AzureOpenAI.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AzureOpenAI @JvmOverloads constructor(
2323
private val azureBaseUrl: String = "",
2424
private val apiVersion: String = "2023-03-15-preview",
2525
private val modelName: String = ""
26-
) : OpenAI(apiKey, organization, client) {
26+
) : OpenAIImpl(apiKey, organization, client) {
2727

2828
override fun buildRequest(request: Any, endpoint: String): Request {
2929
val json = gson.toJson(request)

src/main/kotlin/com/cjcrafter/openai/FinishReason.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,26 @@ enum class FinishReason {
1818
STOP,
1919

2020
/**
21-
* [LENGTH] occurs when the bot is not able to finish the response within
22-
* its token limit. When it reaches the token limit, it sends the
23-
* incomplete message with finish reason [LENGTH]
21+
* Occurs when ChatGPT is not able to finish the response within the token
22+
* limit. When the model reaches the token limit, it returns the incomplete
23+
* message with finish reason [LENGTH]. Some models have a higher token
24+
* limit than others.
2425
*/
2526
LENGTH,
2627

2728
/**
28-
* [CONTENT_FILTER] occurs due to a flag from OpenAI's content filters.
29-
* This occurrence is rare, and usually only happens when you blatantly
30-
* misuse/violate OpenAI's terms.
29+
* Occurs due to a flag from OpenAI's content filters. This occurrence is
30+
* rare, and tends to happen when you blatantly violate OpenAI's terms.
3131
*/
32-
CONTENT_FILTER;
32+
CONTENT_FILTER,
33+
34+
/**
35+
* Occurs when the model uses one of the available tools.
36+
*/
37+
TOOL_CALLS,
38+
39+
@Deprecated("functions have been replaced by tools")
40+
FUNCTION_CALL;
3341

3442
companion object {
3543

0 commit comments

Comments
 (0)