Skip to content

Commit 8eb2394

Browse files
fix(api): add missing reasoning effort + model enums (#207)
1 parent 0a60b9a commit 8eb2394

File tree

11 files changed

+1030
-36
lines changed

11 files changed

+1030
-36
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 61
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml

openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantCreateParams.kt

Lines changed: 233 additions & 3 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/BetaAssistantUpdateParams.kt

Lines changed: 513 additions & 13 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/BetaThreadRunCreateParams.kt

Lines changed: 231 additions & 3 deletions
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionCreateParams.kt

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private constructor(
189189
fun presencePenalty(): Optional<Double> = body.presencePenalty()
190190

191191
/**
192-
* **o1 models only**
192+
* **o1 and o3-mini models only**
193193
*
194194
* Constrains effort on reasoning for
195195
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported
@@ -438,7 +438,7 @@ private constructor(
438438
fun _presencePenalty(): JsonField<Double> = body._presencePenalty()
439439

440440
/**
441-
* **o1 models only**
441+
* **o1 and o3-mini models only**
442442
*
443443
* Constrains effort on reasoning for
444444
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported
@@ -801,7 +801,7 @@ private constructor(
801801
Optional.ofNullable(presencePenalty.getNullable("presence_penalty"))
802802

803803
/**
804-
* **o1 models only**
804+
* **o1 and o3-mini models only**
805805
*
806806
* Constrains effort on reasoning for
807807
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -1087,7 +1087,7 @@ private constructor(
10871087
fun _presencePenalty(): JsonField<Double> = presencePenalty
10881088

10891089
/**
1090-
* **o1 models only**
1090+
* **o1 and o3-mini models only**
10911091
*
10921092
* Constrains effort on reasoning for
10931093
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -2013,18 +2013,29 @@ private constructor(
20132013
}
20142014

20152015
/**
2016-
* **o1 models only**
2016+
* **o1 and o3-mini models only**
20172017
*
20182018
* Constrains effort on reasoning for
20192019
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
20202020
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
20212021
* result in faster responses and fewer tokens used on reasoning in a response.
20222022
*/
2023-
fun reasoningEffort(reasoningEffort: ChatCompletionReasoningEffort) =
2024-
reasoningEffort(JsonField.of(reasoningEffort))
2023+
fun reasoningEffort(reasoningEffort: ChatCompletionReasoningEffort?) =
2024+
reasoningEffort(JsonField.ofNullable(reasoningEffort))
20252025

20262026
/**
2027-
* **o1 models only**
2027+
* **o1 and o3-mini models only**
2028+
*
2029+
* Constrains effort on reasoning for
2030+
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
2031+
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
2032+
* result in faster responses and fewer tokens used on reasoning in a response.
2033+
*/
2034+
fun reasoningEffort(reasoningEffort: Optional<ChatCompletionReasoningEffort>) =
2035+
reasoningEffort(reasoningEffort.orElse(null))
2036+
2037+
/**
2038+
* **o1 and o3-mini models only**
20282039
*
20292040
* Constrains effort on reasoning for
20302041
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -3175,19 +3186,30 @@ private constructor(
31753186
}
31763187

31773188
/**
3178-
* **o1 models only**
3189+
* **o1 and o3-mini models only**
31793190
*
31803191
* Constrains effort on reasoning for
31813192
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
31823193
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can result in
31833194
* faster responses and fewer tokens used on reasoning in a response.
31843195
*/
3185-
fun reasoningEffort(reasoningEffort: ChatCompletionReasoningEffort) = apply {
3196+
fun reasoningEffort(reasoningEffort: ChatCompletionReasoningEffort?) = apply {
31863197
body.reasoningEffort(reasoningEffort)
31873198
}
31883199

31893200
/**
3190-
* **o1 models only**
3201+
* **o1 and o3-mini models only**
3202+
*
3203+
* Constrains effort on reasoning for
3204+
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
3205+
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can result in
3206+
* faster responses and fewer tokens used on reasoning in a response.
3207+
*/
3208+
fun reasoningEffort(reasoningEffort: Optional<ChatCompletionReasoningEffort>) =
3209+
reasoningEffort(reasoningEffort.orElse(null))
3210+
3211+
/**
3212+
* **o1 and o3-mini models only**
31913213
*
31923214
* Constrains effort on reasoning for
31933215
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently

openai-java-core/src/main/kotlin/com/openai/models/ChatCompletionReasoningEffort.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.openai.core.JsonField
88
import com.openai.errors.OpenAIInvalidDataException
99

1010
/**
11-
* **o1 models only**
11+
* **o1 and o3-mini models only**
1212
*
1313
* Constrains effort on reasoning for
1414
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently supported values

openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class BetaAssistantCreateParamsTest {
1818
Metadata.builder().putAdditionalProperty("foo", JsonValue.from("string")).build()
1919
)
2020
.name("name")
21+
.reasoningEffort(BetaAssistantCreateParams.ReasoningEffort.LOW)
2122
.responseFormatAuto()
2223
.temperature(1.0)
2324
.toolResources(
@@ -66,6 +67,7 @@ class BetaAssistantCreateParamsTest {
6667
.build()
6768
)
6869
.name("name")
70+
.reasoningEffort(BetaAssistantCreateParams.ReasoningEffort.LOW)
6971
.responseFormatAuto()
7072
.temperature(1.0)
7173
.toolResources(
@@ -112,6 +114,7 @@ class BetaAssistantCreateParamsTest {
112114
Metadata.builder().putAdditionalProperty("foo", JsonValue.from("string")).build()
113115
)
114116
assertThat(body.name()).contains("name")
117+
assertThat(body.reasoningEffort()).contains(BetaAssistantCreateParams.ReasoningEffort.LOW)
115118
assertThat(body.responseFormat()).contains(AssistantResponseFormatOption.ofAuto())
116119
assertThat(body.temperature()).contains(1.0)
117120
assertThat(body.toolResources())

openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantUpdateParamsTest.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class BetaAssistantUpdateParamsTest {
1717
.metadata(
1818
Metadata.builder().putAdditionalProperty("foo", JsonValue.from("string")).build()
1919
)
20-
.model("model")
20+
.model(BetaAssistantUpdateParams.Model.O3_MINI)
2121
.name("name")
22+
.reasoningEffort(BetaAssistantUpdateParams.ReasoningEffort.LOW)
2223
.responseFormatAuto()
2324
.temperature(1.0)
2425
.toolResources(
@@ -52,8 +53,9 @@ class BetaAssistantUpdateParamsTest {
5253
.putAdditionalProperty("foo", JsonValue.from("string"))
5354
.build()
5455
)
55-
.model("model")
56+
.model(BetaAssistantUpdateParams.Model.O3_MINI)
5657
.name("name")
58+
.reasoningEffort(BetaAssistantUpdateParams.ReasoningEffort.LOW)
5759
.responseFormatAuto()
5860
.temperature(1.0)
5961
.toolResources(
@@ -81,8 +83,9 @@ class BetaAssistantUpdateParamsTest {
8183
.contains(
8284
Metadata.builder().putAdditionalProperty("foo", JsonValue.from("string")).build()
8385
)
84-
assertThat(body.model()).contains("model")
86+
assertThat(body.model()).contains(BetaAssistantUpdateParams.Model.O3_MINI)
8587
assertThat(body.name()).contains("name")
88+
assertThat(body.reasoningEffort()).contains(BetaAssistantUpdateParams.ReasoningEffort.LOW)
8689
assertThat(body.responseFormat()).contains(AssistantResponseFormatOption.ofAuto())
8790
assertThat(body.temperature()).contains(1.0)
8891
assertThat(body.toolResources())

openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class BetaThreadRunCreateParamsTest {
4141
)
4242
.model(ChatModel.O3_MINI)
4343
.parallelToolCalls(true)
44+
.reasoningEffort(BetaThreadRunCreateParams.ReasoningEffort.LOW)
4445
.responseFormatAuto()
4546
.temperature(1.0)
4647
.toolChoice(AssistantToolChoiceOption.Auto.NONE)
@@ -90,6 +91,7 @@ class BetaThreadRunCreateParamsTest {
9091
)
9192
.model(ChatModel.O3_MINI)
9293
.parallelToolCalls(true)
94+
.reasoningEffort(BetaThreadRunCreateParams.ReasoningEffort.LOW)
9395
.responseFormatAuto()
9496
.temperature(1.0)
9597
.toolChoice(AssistantToolChoiceOption.Auto.NONE)
@@ -156,6 +158,7 @@ class BetaThreadRunCreateParamsTest {
156158
)
157159
.model(ChatModel.O3_MINI)
158160
.parallelToolCalls(true)
161+
.reasoningEffort(BetaThreadRunCreateParams.ReasoningEffort.LOW)
159162
.responseFormatAuto()
160163
.temperature(1.0)
161164
.toolChoice(AssistantToolChoiceOption.Auto.NONE)
@@ -201,6 +204,7 @@ class BetaThreadRunCreateParamsTest {
201204
)
202205
assertThat(body.model()).contains(ChatModel.O3_MINI)
203206
assertThat(body.parallelToolCalls()).contains(true)
207+
assertThat(body.reasoningEffort()).contains(BetaThreadRunCreateParams.ReasoningEffort.LOW)
204208
assertThat(body.responseFormat()).contains(AssistantResponseFormatOption.ofAuto())
205209
assertThat(body.temperature()).contains(1.0)
206210
assertThat(body.toolChoice())

openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class AssistantServiceTest {
4040
.build()
4141
)
4242
.name("name")
43+
.reasoningEffort(BetaAssistantCreateParams.ReasoningEffort.LOW)
4344
.responseFormatAuto()
4445
.temperature(1.0)
4546
.toolResources(
@@ -117,8 +118,9 @@ class AssistantServiceTest {
117118
.putAdditionalProperty("foo", JsonValue.from("string"))
118119
.build()
119120
)
120-
.model("model")
121+
.model(BetaAssistantUpdateParams.Model.O3_MINI)
121122
.name("name")
123+
.reasoningEffort(BetaAssistantUpdateParams.ReasoningEffort.LOW)
122124
.responseFormatAuto()
123125
.temperature(1.0)
124126
.toolResources(

openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class RunServiceTest {
6464
)
6565
.model(ChatModel.O3_MINI)
6666
.parallelToolCalls(true)
67+
.reasoningEffort(BetaThreadRunCreateParams.ReasoningEffort.LOW)
6768
.responseFormatAuto()
6869
.temperature(1.0)
6970
.toolChoice(AssistantToolChoiceOption.Auto.NONE)
@@ -124,6 +125,7 @@ class RunServiceTest {
124125
)
125126
.model(ChatModel.O3_MINI)
126127
.parallelToolCalls(true)
128+
.reasoningEffort(BetaThreadRunCreateParams.ReasoningEffort.LOW)
127129
.responseFormatAuto()
128130
.temperature(1.0)
129131
.toolChoice(AssistantToolChoiceOption.Auto.NONE)

0 commit comments

Comments
 (0)