@@ -29,6 +29,7 @@ import com.openai.models.conversations.Message
2929import com.openai.models.responses.ResponseApplyPatchToolCall
3030import com.openai.models.responses.ResponseApplyPatchToolCallOutput
3131import com.openai.models.responses.ResponseCodeInterpreterToolCall
32+ import com.openai.models.responses.ResponseCompactionItem
3233import com.openai.models.responses.ResponseComputerToolCall
3334import com.openai.models.responses.ResponseComputerToolCallOutputItem
3435import com.openai.models.responses.ResponseCustomToolCall
@@ -67,6 +68,7 @@ private constructor(
6768 private val toolSearchCall: ResponseToolSearchCall ? = null ,
6869 private val toolSearchOutput: ResponseToolSearchOutputItem ? = null ,
6970 private val reasoning: ResponseReasoningItem ? = null ,
71+ private val compaction: ResponseCompactionItem ? = null ,
7072 private val codeInterpreterCall: ResponseCodeInterpreterToolCall ? = null ,
7173 private val localShellCall: LocalShellCall ? = null ,
7274 private val localShellCallOutput: LocalShellCallOutput ? = null ,
@@ -137,6 +139,12 @@ private constructor(
137139 */
138140 fun reasoning (): Optional <ResponseReasoningItem > = Optional .ofNullable(reasoning)
139141
142+ /* *
143+ * A compaction item generated by the
144+ * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
145+ */
146+ fun compaction (): Optional <ResponseCompactionItem > = Optional .ofNullable(compaction)
147+
140148 /* * A tool call to run code. */
141149 fun codeInterpreterCall (): Optional <ResponseCodeInterpreterToolCall > =
142150 Optional .ofNullable(codeInterpreterCall)
@@ -204,6 +212,8 @@ private constructor(
204212
205213 fun isReasoning (): Boolean = reasoning != null
206214
215+ fun isCompaction (): Boolean = compaction != null
216+
207217 fun isCodeInterpreterCall (): Boolean = codeInterpreterCall != null
208218
209219 fun isLocalShellCall (): Boolean = localShellCall != null
@@ -284,6 +294,12 @@ private constructor(
284294 */
285295 fun asReasoning (): ResponseReasoningItem = reasoning.getOrThrow(" reasoning" )
286296
297+ /* *
298+ * A compaction item generated by the
299+ * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
300+ */
301+ fun asCompaction (): ResponseCompactionItem = compaction.getOrThrow(" compaction" )
302+
287303 /* * A tool call to run code. */
288304 fun asCodeInterpreterCall (): ResponseCodeInterpreterToolCall =
289305 codeInterpreterCall.getOrThrow(" codeInterpreterCall" )
@@ -345,6 +361,7 @@ private constructor(
345361 toolSearchCall != null -> visitor.visitToolSearchCall(toolSearchCall)
346362 toolSearchOutput != null -> visitor.visitToolSearchOutput(toolSearchOutput)
347363 reasoning != null -> visitor.visitReasoning(reasoning)
364+ compaction != null -> visitor.visitCompaction(compaction)
348365 codeInterpreterCall != null -> visitor.visitCodeInterpreterCall(codeInterpreterCall)
349366 localShellCall != null -> visitor.visitLocalShellCall(localShellCall)
350367 localShellCallOutput != null -> visitor.visitLocalShellCallOutput(localShellCallOutput)
@@ -418,6 +435,10 @@ private constructor(
418435 reasoning.validate()
419436 }
420437
438+ override fun visitCompaction (compaction : ResponseCompactionItem ) {
439+ compaction.validate()
440+ }
441+
421442 override fun visitCodeInterpreterCall (
422443 codeInterpreterCall : ResponseCodeInterpreterToolCall
423444 ) {
@@ -532,6 +553,9 @@ private constructor(
532553
533554 override fun visitReasoning (reasoning : ResponseReasoningItem ) = reasoning.validity()
534555
556+ override fun visitCompaction (compaction : ResponseCompactionItem ) =
557+ compaction.validity()
558+
535559 override fun visitCodeInterpreterCall (
536560 codeInterpreterCall : ResponseCodeInterpreterToolCall
537561 ) = codeInterpreterCall.validity()
@@ -594,6 +618,7 @@ private constructor(
594618 toolSearchCall == other.toolSearchCall &&
595619 toolSearchOutput == other.toolSearchOutput &&
596620 reasoning == other.reasoning &&
621+ compaction == other.compaction &&
597622 codeInterpreterCall == other.codeInterpreterCall &&
598623 localShellCall == other.localShellCall &&
599624 localShellCallOutput == other.localShellCallOutput &&
@@ -622,6 +647,7 @@ private constructor(
622647 toolSearchCall,
623648 toolSearchOutput,
624649 reasoning,
650+ compaction,
625651 codeInterpreterCall,
626652 localShellCall,
627653 localShellCallOutput,
@@ -651,6 +677,7 @@ private constructor(
651677 toolSearchCall != null -> " ConversationItem{toolSearchCall=$toolSearchCall }"
652678 toolSearchOutput != null -> " ConversationItem{toolSearchOutput=$toolSearchOutput }"
653679 reasoning != null -> " ConversationItem{reasoning=$reasoning }"
680+ compaction != null -> " ConversationItem{compaction=$compaction }"
654681 codeInterpreterCall != null ->
655682 " ConversationItem{codeInterpreterCall=$codeInterpreterCall }"
656683 localShellCall != null -> " ConversationItem{localShellCall=$localShellCall }"
@@ -744,6 +771,14 @@ private constructor(
744771 @JvmStatic
745772 fun ofReasoning (reasoning : ResponseReasoningItem ) = ConversationItem (reasoning = reasoning)
746773
774+ /* *
775+ * A compaction item generated by the
776+ * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
777+ */
778+ @JvmStatic
779+ fun ofCompaction (compaction : ResponseCompactionItem ) =
780+ ConversationItem (compaction = compaction)
781+
747782 /* * A tool call to run code. */
748783 @JvmStatic
749784 fun ofCodeInterpreterCall (codeInterpreterCall : ResponseCodeInterpreterToolCall ) =
@@ -864,6 +899,12 @@ private constructor(
864899 */
865900 fun visitReasoning (reasoning : ResponseReasoningItem ): T
866901
902+ /* *
903+ * A compaction item generated by the
904+ * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).
905+ */
906+ fun visitCompaction (compaction : ResponseCompactionItem ): T
907+
867908 /* * A tool call to run code. */
868909 fun visitCodeInterpreterCall (codeInterpreterCall : ResponseCodeInterpreterToolCall ): T
869910
@@ -986,6 +1027,11 @@ private constructor(
9861027 ConversationItem (reasoning = it, _json = json)
9871028 } ? : ConversationItem (_json = json)
9881029 }
1030+ " compaction" -> {
1031+ return tryDeserialize(node, jacksonTypeRef<ResponseCompactionItem >())?.let {
1032+ ConversationItem (compaction = it, _json = json)
1033+ } ? : ConversationItem (_json = json)
1034+ }
9891035 " code_interpreter_call" -> {
9901036 return tryDeserialize(node, jacksonTypeRef<ResponseCodeInterpreterToolCall >())
9911037 ?.let { ConversationItem (codeInterpreterCall = it, _json = json) }
@@ -1080,6 +1126,7 @@ private constructor(
10801126 value.toolSearchCall != null -> generator.writeObject(value.toolSearchCall)
10811127 value.toolSearchOutput != null -> generator.writeObject(value.toolSearchOutput)
10821128 value.reasoning != null -> generator.writeObject(value.reasoning)
1129+ value.compaction != null -> generator.writeObject(value.compaction)
10831130 value.codeInterpreterCall != null ->
10841131 generator.writeObject(value.codeInterpreterCall)
10851132 value.localShellCall != null -> generator.writeObject(value.localShellCall)
0 commit comments