class documentation

class TestModel(Model): (source)

Constructor: TestModel(fn)

View In Hierarchy

Test model for use mocking model responses.

Method __init__ Initialize a test model with a callable.
Async Method get_response Get a response from the model.
Method stream_response Get a streamed response from the model. Unimplemented.
Instance Variable fn Undocumented
def __init__(self, fn: Callable[[], ModelResponse]): (source)

Initialize a test model with a callable.

async def get_response(self, system_instructions: str | None, input: str | list[TResponseInputItem], model_settings: ModelSettings, tools: list[Tool], output_schema: AgentOutputSchemaBase | None, handoffs: list[Handoff], tracing: ModelTracing, *, previous_response_id: str | None, prompt: ResponsePromptParam | None = None) -> ModelResponse: (source)

Get a response from the model.

def stream_response(self, system_instructions: str | None, input: str | list[TResponseInputItem], model_settings: ModelSettings, tools: list[Tool], output_schema: AgentOutputSchemaBase | None, handoffs: list[Handoff], tracing: ModelTracing, *, previous_response_id: str | None, prompt: ResponsePromptParam | None) -> AsyncIterator[TResponseStreamEvent]: (source)

Get a streamed response from the model. Unimplemented.

Undocumented