OpenAIResponseInputItemSerializer

Polymorphic serializer for OpenAIResponseInputItem items that come from the OpenAI Responses API as plain JSON objects with a type discriminator.

Serialization side: the type field is added in front of the item's own fields, since OpenAIResponseInputItem subclasses don't carry it themselves.

Deserialization side: items are dispatched by their type field. The special "message" type maps to three Kotlin classes sharing one serial name:

All other types are mapped 1:1 to their serializers: function_call, function_call_output, reasoning, file_search_call, mcp_list_tools, computer_call, computer_call_output, web_search_call, item_reference, mcp_call, mcp_approval_request, mcp_approval_response, image_generation_call, code_interpreter_call, custom_tool_call, custom_tool_call_output, local_shell_call, local_shell_call_output.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): OpenAIResponseInputItem
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: OpenAIResponseInputItem)