Skip to content

Commit 4356af7

Browse files
committed
Merge remote-tracking branch 'up/main'
2 parents 6246819 + ebb2d52 commit 4356af7

File tree

11 files changed

+42
-23
lines changed

11 files changed

+42
-23
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
## Unreleased
1+
## 3.7.0
22

33
### Added
44
- add `RequestOptions` (#296)
55

6+
### Fixed
7+
- **chat**: add `systemFingerprint` to `ChatCompletionChunk` (#303)
8+
- **chat**: move `description` to `FunctionTool` (#304)
9+
- **chat**: make `FunctionTool#Parameters` nullable (#304)
10+
- **finetuning**: nullable `ErrorInfo#message` and `ErrorInfo#code` (#304)
11+
- **image**: correct `Quality` package name (#302) (thanks @voqaldev)
12+
- **assistants**: files endpoint (#298) (thanks @rjeeb)
13+
- **runs**: `RunRequest` builder
14+
615
## 3.6.3
716
> Published 13 Jan 2024
817

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repositories {
1717
}
1818
1919
dependencies {
20-
implementation "com.aallam.openai:openai-client:3.6.3"
20+
implementation "com.aallam.openai:openai-client:3.7.0"
2121
}
2222
```
2323

@@ -30,7 +30,7 @@ Alternatively, you can use [openai-client-bom](/openai-client-bom) by adding th
3030
```groovy
3131
dependencies {
3232
// import Kotlin API client BOM
33-
implementation platform('com.aallam.openai:openai-client-bom:3.6.3')
33+
implementation platform('com.aallam.openai:openai-client-bom:3.7.0')
3434
3535
// define dependencies without versions
3636
implementation 'com.aallam.openai:openai-client'
@@ -57,7 +57,7 @@ of [Ktor's engines](https://ktor.io/docs/http-client-engines.html).
5757
<dependency>
5858
<groupId>com.aallam.openai</groupId>
5959
<artifactId>openai-client-jvm</artifactId>
60-
<version>3.6.3</version>
60+
<version>3.7.0</version>
6161
</dependency>
6262

6363
<dependency>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kotlin.js.compiler=ir
55

66
# Lib
77
GROUP=com.aallam.openai
8-
VERSION_NAME=3.7.0-SNAPSHOT
8+
VERSION_NAME=3.7.0
99

1010
# OSS
1111
SONATYPE_HOST=DEFAULT

openai-client/src/commonMain/kotlin/com.aallam.openai.client/internal/api/AssistantsApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ internal class AssistantsApi(val requester: HttpRequester) : Assistants {
133133
val request = buildJsonObject { put("file", fileId.id) }
134134
return requester.perform {
135135
it.post {
136-
url(path = "${ApiPath.Assistants}/${assistantId.id}")
136+
url(path = "${ApiPath.Assistants}/${assistantId.id}/files")
137137
setBody(request)
138138
contentType(ContentType.Application.Json)
139139
beta("assistants", 1)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* The quality of the image that will be generated
3+
*/
4+
@Deprecated("This class is deprecated.", ReplaceWith("Quality", "com.aallam.openai.api.image.Quality"))
5+
public typealias Quality = com.aallam.openai.api.image.Quality

openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletionChunk.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,10 @@ public data class ChatCompletionChunk(
4949
*/
5050
@SerialName("prompt_filter_results")
5151
val promptFilterResults: List<ContentFilterResultsForPrompt>? = null
52+
* This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with
53+
* the `seed` request parameter to understand when backend changes have been made that might impact determinism.
54+
*/
55+
56+
@SerialName("system_fingerprint")
57+
public val systemFingerprint: String? = null,
5258
)

openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Tool.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ public data class Tool(
1515
*/
1616
@SerialName("type") val type: ToolType,
1717

18-
/**
19-
* Tool description.
20-
*/
21-
@SerialName("description") val description: String? = null,
22-
2318
/**
2419
* A description of what the function does, used by the model to choose when and how to call the function.
2520
*/
@@ -38,8 +33,7 @@ public data class Tool(
3833
public fun function(name: String, description: String? = null, parameters: Parameters): Tool =
3934
Tool(
4035
type = ToolType.Function,
41-
description = description,
42-
function = FunctionTool(name = name, parameters = parameters)
36+
function = FunctionTool(name = name, description = description, parameters = parameters)
4337
)
4438
}
4539
}
@@ -56,12 +50,17 @@ public data class FunctionTool(
5650
@SerialName("name") val name: String,
5751

5852
/**
59-
* The parameters the function accepts, described as a JSON Schema object.
60-
* See the [guide](https://github.com/aallam/openai-kotlin/blob/main/guides/ChatToolCalls.md) for examples,
61-
* and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about
53+
* The parameters the functions accept, described as a JSON Schema object.
54+
* See the [guide](https://platform.openai.com/docs/guides/text-generation/function-calling) for examples,
55+
* and the [JSON Schema reference](https://json-schema.org/understanding-json-schema) for documentation about
6256
* the format.
6357
*
64-
* To describe a function that accepts no parameters, provide [Parameters.Empty]`.
58+
* Omitting `parameters` defines a function with an empty parameter list.
59+
*/
60+
@SerialName("parameters") val parameters: Parameters? = null,
61+
62+
/**
63+
* A description of what the function does, used by the model to choose when and how to call the function.
6564
*/
66-
@SerialName("parameters") val parameters: Parameters
65+
@SerialName("description") public val description: String? = null
6766
)

openai-core/src/commonMain/kotlin/com.aallam.openai.api/finetuning/ErrorInfo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ public data class ErrorInfo(
1111
/**
1212
* A human-readable error message.
1313
*/
14-
val message: String,
14+
val message: String? = null,
1515

1616
/**
1717
* A machine-readable error code.
1818
*/
19-
val code: String,
19+
val code: String? = null,
2020

2121
/**
2222
* The parameter that was invalid (e.g., `training_file`, `validation_file`), or null if not parameter-specific.

openai-core/src/commonMain/kotlin/com.aallam.openai.api/image/ImageCreation.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.aallam.openai.api.image
22

3-
import Quality
43
import com.aallam.openai.api.BetaOpenAI
54
import com.aallam.openai.api.OpenAIDsl
65
import com.aallam.openai.api.model.ModelId

openai-core/src/commonMain/kotlin/com.aallam.openai.api/image/Quality.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package com.aallam.openai.api.image
2+
13
import kotlinx.serialization.Serializable
24
import kotlin.jvm.JvmInline
35

openai-core/src/commonMain/kotlin/com.aallam.openai.api/image/internal/ImageCreationRequest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.aallam.openai.api.image.internal
22

3-
import Quality
4-
import com.aallam.openai.api.BetaOpenAI
53
import com.aallam.openai.api.InternalOpenAI
64
import com.aallam.openai.api.image.ImageSize
5+
import com.aallam.openai.api.image.Quality
76
import com.aallam.openai.api.image.Style
87
import kotlinx.serialization.SerialName
98
import kotlinx.serialization.Serializable

0 commit comments

Comments
 (0)