@@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
6
6
import com.fasterxml.jackson.annotation.JsonAnySetter
7
7
import com.fasterxml.jackson.annotation.JsonCreator
8
8
import com.fasterxml.jackson.annotation.JsonProperty
9
- import com.openai.core.Enum
10
9
import com.openai.core.ExcludeMissing
11
10
import com.openai.core.JsonField
12
11
import com.openai.core.JsonMissing
@@ -37,9 +36,7 @@ private constructor(
37
36
@JsonProperty(" metadata" ) @ExcludeMissing private val metadata: JsonValue = JsonMissing .of(),
38
37
@JsonProperty(" model" ) @ExcludeMissing private val model: JsonField <String > = JsonMissing .of(),
39
38
@JsonProperty(" name" ) @ExcludeMissing private val name: JsonField <String > = JsonMissing .of(),
40
- @JsonProperty(" object" )
41
- @ExcludeMissing
42
- private val object_: JsonField <Object > = JsonMissing .of(),
39
+ @JsonProperty(" object" ) @ExcludeMissing private val object_: JsonValue = JsonMissing .of(),
43
40
@JsonProperty(" tools" )
44
41
@ExcludeMissing
45
42
private val tools: JsonField <List <AssistantTool >> = JsonMissing .of(),
@@ -91,7 +88,7 @@ private constructor(
91
88
fun name (): Optional <String > = Optional .ofNullable(name.getNullable(" name" ))
92
89
93
90
/* * The object type, which is always `assistant`. */
94
- fun object_ (): Object = object_.getRequired( " object " )
91
+ @JsonProperty( " object " ) @ExcludeMissing fun _object_ (): JsonValue = object_
95
92
96
93
/* *
97
94
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant.
@@ -173,9 +170,6 @@ private constructor(
173
170
/* * The name of the assistant. The maximum length is 256 characters. */
174
171
@JsonProperty(" name" ) @ExcludeMissing fun _name (): JsonField <String > = name
175
172
176
- /* * The object type, which is always `assistant`. */
177
- @JsonProperty(" object" ) @ExcludeMissing fun _object_ (): JsonField <Object > = object_
178
-
179
173
/* *
180
174
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant.
181
175
* Tools can be of types `code_interpreter`, `file_search`, or `function`.
@@ -247,7 +241,11 @@ private constructor(
247
241
instructions()
248
242
model()
249
243
name()
250
- object_()
244
+ _object_ ().let {
245
+ if (it != JsonValue .from(" assistant" )) {
246
+ throw OpenAIInvalidDataException (" 'object_' is invalid, received $it " )
247
+ }
248
+ }
251
249
tools().forEach { it.validate() }
252
250
responseFormat().ifPresent { it.validate() }
253
251
temperature()
@@ -272,7 +270,7 @@ private constructor(
272
270
private var metadata: JsonValue ? = null
273
271
private var model: JsonField <String >? = null
274
272
private var name: JsonField <String >? = null
275
- private var object_: JsonField < Object > ? = null
273
+ private var object_: JsonValue = JsonValue .from( " assistant " )
276
274
private var tools: JsonField <MutableList <AssistantTool >>? = null
277
275
private var responseFormat: JsonField <AssistantResponseFormatOption > = JsonMissing .of()
278
276
private var temperature: JsonField <Double > = JsonMissing .of()
@@ -372,10 +370,7 @@ private constructor(
372
370
fun name (name : JsonField <String >) = apply { this .name = name }
373
371
374
372
/* * The object type, which is always `assistant`. */
375
- fun object_ (object_ : Object ) = object_(JsonField .of(object_))
376
-
377
- /* * The object type, which is always `assistant`. */
378
- fun object_ (object_ : JsonField <Object >) = apply { this .object_ = object_ }
373
+ fun object_ (object_ : JsonValue ) = apply { this .object_ = object_ }
379
374
380
375
/* *
381
376
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
@@ -500,8 +495,7 @@ private constructor(
500
495
}
501
496
502
497
/* * `auto` is the default value */
503
- fun responseFormat (behavior : AssistantResponseFormatOption .Behavior ) =
504
- responseFormat(AssistantResponseFormatOption .ofBehavior(behavior))
498
+ fun responseFormatAuto () = responseFormat(AssistantResponseFormatOption .ofAuto())
505
499
506
500
/* *
507
501
* Specifies the format that the model must output. Compatible with
@@ -696,7 +690,7 @@ private constructor(
696
690
checkRequired(" metadata" , metadata),
697
691
checkRequired(" model" , model),
698
692
checkRequired(" name" , name),
699
- checkRequired( " object_" , object_) ,
693
+ object_,
700
694
checkRequired(" tools" , tools).map { it.toImmutable() },
701
695
responseFormat,
702
696
temperature,
@@ -706,58 +700,6 @@ private constructor(
706
700
)
707
701
}
708
702
709
- /* * The object type, which is always `assistant`. */
710
- class Object
711
- @JsonCreator
712
- private constructor (
713
- private val value: JsonField <String >,
714
- ) : Enum {
715
-
716
- @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
717
-
718
- companion object {
719
-
720
- @JvmField val ASSISTANT = of(" assistant" )
721
-
722
- @JvmStatic fun of (value : String ) = Object (JsonField .of(value))
723
- }
724
-
725
- enum class Known {
726
- ASSISTANT ,
727
- }
728
-
729
- enum class Value {
730
- ASSISTANT ,
731
- _UNKNOWN ,
732
- }
733
-
734
- fun value (): Value =
735
- when (this ) {
736
- ASSISTANT -> Value .ASSISTANT
737
- else -> Value ._UNKNOWN
738
- }
739
-
740
- fun known (): Known =
741
- when (this ) {
742
- ASSISTANT -> Known .ASSISTANT
743
- else -> throw OpenAIInvalidDataException (" Unknown Object: $value " )
744
- }
745
-
746
- fun asString (): String = _value ().asStringOrThrow()
747
-
748
- override fun equals (other : Any? ): Boolean {
749
- if (this == = other) {
750
- return true
751
- }
752
-
753
- return /* spotless:off */ other is Object && value == other.value /* spotless:on */
754
- }
755
-
756
- override fun hashCode () = value.hashCode()
757
-
758
- override fun toString () = value.toString()
759
- }
760
-
761
703
/* *
762
704
* A set of resources that are used by the assistant's tools. The resources are specific to the
763
705
* type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the
0 commit comments