class documentation

class FakeModel(BaseChatModel): (source)

Constructor: FakeModel(responses, **kwargs)

View In Hierarchy

A BaseChatModel returning scripted responses, for offline tests.

Parameters
responsesReplies returned one per call, cycling when exhausted. Each is either a string (becomes an AIMessage) or an AIMessage (so you can script tool_calls to drive the agent's tool path).
Method __init__ Validate and store the scripted responses.
Method bind_tools Ignore the tool set; the fake just replays its script.
Class Variable responses Undocumented
Async Method _agenerate Undocumented
Method _generate Undocumented
Method _next Undocumented
Class Variable _cursor Undocumented
Property _llm_type Undocumented
def __init__(self, responses: Sequence[Response], **kwargs: Any): (source)

Validate and store the scripted responses.

def bind_tools(self, tools: Sequence[Any], **kwargs: Any) -> FakeModel: (source)

Ignore the tool set; the fake just replays its script.

Returning self keeps model.bind_tools(...) chainable like a real model.

responses: list[Any] = (source)

Undocumented

async def _agenerate(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: AsyncCallbackManagerForLLMRun | None = None, **kwargs: Any) -> ChatResult: (source)

Undocumented

def _generate(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: CallbackManagerForLLMRun | None = None, **kwargs: Any) -> ChatResult: (source)

Undocumented

def _next(self) -> AIMessage: (source)

Undocumented

Undocumented

Undocumented