From 6b0810d602ea0075060b8e36d521c5c1169af725 Mon Sep 17 00:00:00 2001 From: anish k Date: Sat, 25 Apr 2026 00:50:35 +0000 Subject: [PATCH] fix(types): expand FunctionCallOutput.output to accept str or list - [ ] I understand that this repository is auto-generated and my pull request may not be merged Signed-off-by: anish k --- tests/test_models.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_models.py b/tests/test_models.py index 588869ee35..2bf118604f 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -961,3 +961,33 @@ def __getattr__(self, attr: str) -> Item: ... assert model.a.prop == 1 assert isinstance(model.a, Item) assert model.other == "foo" + + +def test_function_call_output_accepts_string_and_list() -> None: + """Regression test: FunctionCallOutput.output should accept both str and list.""" + from openai.types.responses.response_input_item import FunctionCallOutput + + # string output (original behavior) + m_str = construct_type( + type_=FunctionCallOutput, + value={ + "call_id": "call_abc123", + "output": '{"result": 42}', + "type": "function_call_output", + }, + ) + assert isinstance(m_str, FunctionCallOutput) + assert m_str.output == '{"result": 42}' + + # list output (expanded type per API docs) + m_list = construct_type( + type_=FunctionCallOutput, + value={ + "call_id": "call_abc123", + "output": [{"type": "input_text", "text": "hello"}], + "type": "function_call_output", + }, + ) + assert isinstance(m_list, FunctionCallOutput) + assert isinstance(m_list.output, list) + assert len(m_list.output) == 1