22import uuid
33from dataclasses import dataclass
44from datetime import timedelta
5- from typing import Any , Optional , Union , no_type_check
5+ from typing import Any , Optional , Union , no_type_check , cast
66
77import pytest
88from pydantic import ConfigDict , Field
6464 ResponseFunctionToolCall ,
6565 ResponseFunctionWebSearch ,
6666 ResponseOutputMessage ,
67- ResponseOutputText ,
68- )
67+ ResponseOutputText , EasyInputMessageParam ,
68+ )
6969 from openai .types .responses .response_function_web_search import ActionSearch
7070 from openai .types .responses .response_prompt_param import ResponsePromptParam
7171
@@ -98,6 +98,7 @@ def __init__(
9898 ) -> None :
9999 global response_index
100100 response_index = 0
101+ self .inputs : list [Union [str , list [TResponseInputItem ]]] = []
101102 super ().__init__ (model , openai_client )
102103
103104 async def get_response (
@@ -115,6 +116,7 @@ async def get_response(
115116 global response_index
116117 response = self .responses [response_index ]
117118 response_index += 1
119+ self .inputs .append (input )
118120 return response
119121
120122
@@ -805,12 +807,11 @@ async def test_agents_as_tools_workflow(client: Client, use_local_model: bool):
805807
806808 model_params = ModelActivityParameters (start_to_close_timeout = timedelta (seconds = 30 ))
807809 with set_open_ai_agent_temporal_overrides (model_params ):
808- model_activity = ModelActivity (
809- TestProvider (
810- AgentAsToolsModel ( # type: ignore
810+ model = AgentAsToolsModel ( # type: ignore
811811 "" , openai_client = AsyncOpenAI (api_key = "Fake key" )
812812 )
813- )
813+ model_activity = ModelActivity (
814+ TestProvider (model )
814815 if use_local_model
815816 else None
816817 )
@@ -862,7 +863,7 @@ async def test_agents_as_tools_workflow(client: Client, use_local_model: bool):
862863 .activity_task_completed_event_attributes .result .payloads [0 ]
863864 .data .decode ()
864865 )
865-
866+ assert isinstance ( cast ( EasyInputMessageParam , model . inputs [ 3 ][ 3 ])[ "content" ], list )
866867
867868class AirlineAgentContext (BaseModel ):
868869 passenger_name : Optional [str ] = None
0 commit comments