Skip to content

Commit 6eb0909

Browse files
feat(api): remove phase from messages and promptCacheKey parameter
1 parent 9217829 commit 6eb0909

31 files changed

+13
-563
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 147
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6bfe886b5ded0fe3bf37ca672698814e16e0836a093ceef65dac37ae44d1ad6b.yml
3-
openapi_spec_hash: 6b1344a59044318e824c8d1af96033c7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a0aa54a302fbd7fff4ed7ad8a8547587d37b63324fc4af652bfa685ee9f8da44.yml
3+
openapi_spec_hash: e45c5af19307cfc8b9baa4b8f8e865a0
44
config_hash: 7f49c38fa3abe9b7038ffe62262c4912

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

Lines changed: 3 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class EasyInputMessage
4141
private constructor(
4242
private val content: JsonField<Content>,
4343
private val role: JsonField<Role>,
44-
private val phase: JsonField<Phase>,
4544
private val type: JsonField<Type>,
4645
private val additionalProperties: MutableMap<String, JsonValue>,
4746
) {
@@ -50,9 +49,8 @@ private constructor(
5049
private constructor(
5150
@JsonProperty("content") @ExcludeMissing content: JsonField<Content> = JsonMissing.of(),
5251
@JsonProperty("role") @ExcludeMissing role: JsonField<Role> = JsonMissing.of(),
53-
@JsonProperty("phase") @ExcludeMissing phase: JsonField<Phase> = JsonMissing.of(),
5452
@JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
55-
) : this(content, role, phase, type, mutableMapOf())
53+
) : this(content, role, type, mutableMapOf())
5654

5755
/**
5856
* Text, image, or audio input to the model, used to generate a response. Can also contain
@@ -71,19 +69,6 @@ private constructor(
7169
*/
7270
fun role(): Role = role.getRequired("role")
7371

74-
/**
75-
* The phase of an assistant message.
76-
*
77-
* Use `commentary` for an intermediate assistant message and `final_answer` for the final
78-
* assistant message. For follow-up requests with models like `gpt-5.3-codex` and later,
79-
* preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not
80-
* used for user messages.
81-
*
82-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
83-
* server responded with an unexpected value).
84-
*/
85-
fun phase(): Optional<Phase> = phase.getOptional("phase")
86-
8772
/**
8873
* The type of the message input. Always `message`.
8974
*
@@ -106,13 +91,6 @@ private constructor(
10691
*/
10792
@JsonProperty("role") @ExcludeMissing fun _role(): JsonField<Role> = role
10893

109-
/**
110-
* Returns the raw JSON value of [phase].
111-
*
112-
* Unlike [phase], this method doesn't throw if the JSON field has an unexpected type.
113-
*/
114-
@JsonProperty("phase") @ExcludeMissing fun _phase(): JsonField<Phase> = phase
115-
11694
/**
11795
* Returns the raw JSON value of [type].
11896
*
@@ -151,15 +129,13 @@ private constructor(
151129

152130
private var content: JsonField<Content>? = null
153131
private var role: JsonField<Role>? = null
154-
private var phase: JsonField<Phase> = JsonMissing.of()
155132
private var type: JsonField<Type> = JsonMissing.of()
156133
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
157134

158135
@JvmSynthetic
159136
internal fun from(easyInputMessage: EasyInputMessage) = apply {
160137
content = easyInputMessage.content
161138
role = easyInputMessage.role
162-
phase = easyInputMessage.phase
163139
type = easyInputMessage.type
164140
additionalProperties = easyInputMessage.additionalProperties.toMutableMap()
165141
}
@@ -200,27 +176,6 @@ private constructor(
200176
*/
201177
fun role(role: JsonField<Role>) = apply { this.role = role }
202178

203-
/**
204-
* The phase of an assistant message.
205-
*
206-
* Use `commentary` for an intermediate assistant message and `final_answer` for the final
207-
* assistant message. For follow-up requests with models like `gpt-5.3-codex` and later,
208-
* preserve and resend phase on all assistant messages. Omitting it can degrade performance.
209-
* Not used for user messages.
210-
*/
211-
fun phase(phase: Phase?) = phase(JsonField.ofNullable(phase))
212-
213-
/** Alias for calling [Builder.phase] with `phase.orElse(null)`. */
214-
fun phase(phase: Optional<Phase>) = phase(phase.getOrNull())
215-
216-
/**
217-
* Sets [Builder.phase] to an arbitrary JSON value.
218-
*
219-
* You should usually call [Builder.phase] with a well-typed [Phase] value instead. This
220-
* method is primarily for setting the field to an undocumented or not yet supported value.
221-
*/
222-
fun phase(phase: JsonField<Phase>) = apply { this.phase = phase }
223-
224179
/** The type of the message input. Always `message`. */
225180
fun type(type: Type) = type(JsonField.of(type))
226181

@@ -268,7 +223,6 @@ private constructor(
268223
EasyInputMessage(
269224
checkRequired("content", content),
270225
checkRequired("role", role),
271-
phase,
272226
type,
273227
additionalProperties.toMutableMap(),
274228
)
@@ -283,7 +237,6 @@ private constructor(
283237

284238
content().validate()
285239
role().validate()
286-
phase().ifPresent { it.validate() }
287240
type().ifPresent { it.validate() }
288241
validated = true
289242
}
@@ -305,7 +258,6 @@ private constructor(
305258
internal fun validity(): Int =
306259
(content.asKnown().getOrNull()?.validity() ?: 0) +
307260
(role.asKnown().getOrNull()?.validity() ?: 0) +
308-
(phase.asKnown().getOrNull()?.validity() ?: 0) +
309261
(type.asKnown().getOrNull()?.validity() ?: 0)
310262

311263
/**
@@ -653,139 +605,6 @@ private constructor(
653605
override fun toString() = value.toString()
654606
}
655607

656-
/**
657-
* The phase of an assistant message.
658-
*
659-
* Use `commentary` for an intermediate assistant message and `final_answer` for the final
660-
* assistant message. For follow-up requests with models like `gpt-5.3-codex` and later,
661-
* preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not
662-
* used for user messages.
663-
*/
664-
class Phase @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
665-
666-
/**
667-
* Returns this class instance's raw value.
668-
*
669-
* This is usually only useful if this instance was deserialized from data that doesn't
670-
* match any known member, and you want to know that value. For example, if the SDK is on an
671-
* older version than the API, then the API may respond with new members that the SDK is
672-
* unaware of.
673-
*/
674-
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
675-
676-
companion object {
677-
678-
@JvmField val COMMENTARY = of("commentary")
679-
680-
@JvmField val FINAL_ANSWER = of("final_answer")
681-
682-
@JvmStatic fun of(value: String) = Phase(JsonField.of(value))
683-
}
684-
685-
/** An enum containing [Phase]'s known values. */
686-
enum class Known {
687-
COMMENTARY,
688-
FINAL_ANSWER,
689-
}
690-
691-
/**
692-
* An enum containing [Phase]'s known values, as well as an [_UNKNOWN] member.
693-
*
694-
* An instance of [Phase] can contain an unknown value in a couple of cases:
695-
* - It was deserialized from data that doesn't match any known member. For example, if the
696-
* SDK is on an older version than the API, then the API may respond with new members that
697-
* the SDK is unaware of.
698-
* - It was constructed with an arbitrary value using the [of] method.
699-
*/
700-
enum class Value {
701-
COMMENTARY,
702-
FINAL_ANSWER,
703-
/** An enum member indicating that [Phase] was instantiated with an unknown value. */
704-
_UNKNOWN,
705-
}
706-
707-
/**
708-
* Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
709-
* if the class was instantiated with an unknown value.
710-
*
711-
* Use the [known] method instead if you're certain the value is always known or if you want
712-
* to throw for the unknown case.
713-
*/
714-
fun value(): Value =
715-
when (this) {
716-
COMMENTARY -> Value.COMMENTARY
717-
FINAL_ANSWER -> Value.FINAL_ANSWER
718-
else -> Value._UNKNOWN
719-
}
720-
721-
/**
722-
* Returns an enum member corresponding to this class instance's value.
723-
*
724-
* Use the [value] method instead if you're uncertain the value is always known and don't
725-
* want to throw for the unknown case.
726-
*
727-
* @throws OpenAIInvalidDataException if this class instance's value is a not a known
728-
* member.
729-
*/
730-
fun known(): Known =
731-
when (this) {
732-
COMMENTARY -> Known.COMMENTARY
733-
FINAL_ANSWER -> Known.FINAL_ANSWER
734-
else -> throw OpenAIInvalidDataException("Unknown Phase: $value")
735-
}
736-
737-
/**
738-
* Returns this class instance's primitive wire representation.
739-
*
740-
* This differs from the [toString] method because that method is primarily for debugging
741-
* and generally doesn't throw.
742-
*
743-
* @throws OpenAIInvalidDataException if this class instance's value does not have the
744-
* expected primitive type.
745-
*/
746-
fun asString(): String =
747-
_value().asString().orElseThrow { OpenAIInvalidDataException("Value is not a String") }
748-
749-
private var validated: Boolean = false
750-
751-
fun validate(): Phase = apply {
752-
if (validated) {
753-
return@apply
754-
}
755-
756-
known()
757-
validated = true
758-
}
759-
760-
fun isValid(): Boolean =
761-
try {
762-
validate()
763-
true
764-
} catch (e: OpenAIInvalidDataException) {
765-
false
766-
}
767-
768-
/**
769-
* Returns a score indicating how many valid values are contained in this object
770-
* recursively.
771-
*
772-
* Used for best match union deserialization.
773-
*/
774-
@JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
775-
776-
override fun equals(other: Any?): Boolean {
777-
if (this === other) {
778-
return true
779-
}
780-
781-
return other is Phase && value == other.value
782-
}
783-
784-
override fun hashCode() = value.hashCode()
785-
786-
override fun toString() = value.toString()
787-
}
788-
789608
/** The type of the message input. Always `message`. */
790609
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
791610

@@ -914,17 +733,14 @@ private constructor(
914733
return other is EasyInputMessage &&
915734
content == other.content &&
916735
role == other.role &&
917-
phase == other.phase &&
918736
type == other.type &&
919737
additionalProperties == other.additionalProperties
920738
}
921739

922-
private val hashCode: Int by lazy {
923-
Objects.hash(content, role, phase, type, additionalProperties)
924-
}
740+
private val hashCode: Int by lazy { Objects.hash(content, role, type, additionalProperties) }
925741

926742
override fun hashCode(): Int = hashCode
927743

928744
override fun toString() =
929-
"EasyInputMessage{content=$content, role=$role, phase=$phase, type=$type, additionalProperties=$additionalProperties}"
745+
"EasyInputMessage{content=$content, role=$role, type=$type, additionalProperties=$additionalProperties}"
930746
}

0 commit comments

Comments
 (0)