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:
OpenAIResponsesOutputMessage - assistant message with an
id(a model output item).OpenAIResponsesEasyInputMessage - assistant message without an
id, or any message whosecontentis a plain string.OpenAIResponsesMessage - any other message (list content or explicit
status).
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.