File tree Expand file tree Collapse file tree 2 files changed +73
-85
lines changed
temporalio/contrib/openai_agents
tests/contrib/openai_agents Expand file tree Collapse file tree 2 files changed +73
-85
lines changed Original file line number Diff line number Diff line change @@ -154,23 +154,11 @@ def stream_response(
154154 """Get a streamed response from the model. Unimplemented."""
155155 raise NotImplementedError ()
156156
157-
158- class StaticTestModel (TestModel ):
159- """Static test model for use mocking model responses.
160- Set a responses attribute to a list of model responses, which will be returned sequentially.
161-
162- .. warning::
163- This API is experimental and may change in the future."""
164-
165- __test__ = False
166- responses : list [ModelResponse ] = []
167-
168- def __init__ (
169- self ,
170- ) -> None :
171- """Initialize the static test model with predefined responses.
157+ @staticmethod
158+ def returning_responses (responses : list [ModelResponse ]) -> "TestModel" :
159+ """Create a mock model which sequentially returns responses from a list.
172160
173161 .. warning::
174162 This API is experimental and may change in the future."""
175- self . _responses = iter (self . responses )
176- super (). __init__ ( lambda : next (self . _responses ))
163+ i = iter (responses )
164+ return TestModel ( lambda : next (i ))
You can’t perform that action at this time.
0 commit comments