Skip to content

Commit 36e99cd

Browse files
fix(chat): JsonSchema strict to be encoded even if it's default value is true (#430)
* fix JsonSchema strict not being encoded to json * fix test additionalProperties required to be false when strict true
1 parent 8e59dbd commit 36e99cd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

openai-client/src/commonTest/kotlin/com/aallam/openai/client/TestChatCompletions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class TestChatCompletions : TestOpenAI() {
152152
"required" to JsonArray(listOf(
153153
JsonPrimitive("question"),
154154
JsonPrimitive("response")
155-
))
155+
)),
156+
"additionalProperties" to JsonPrimitive(false)
156157
))
157158

158159
val jsonSchema = JsonSchema(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ public data class JsonSchema(
5656
/**
5757
* Whether to enforce strict schema validation
5858
*/
59-
@SerialName("strict") val strict: Boolean = true
59+
@SerialName("strict") val strict: Boolean? = null
6060
)

0 commit comments

Comments
 (0)