class documentation
class FakeModel(BaseChatModel): (source)
Constructor: FakeModel(responses, **kwargs)
A BaseChatModel returning scripted responses, for offline tests.
| Parameters | |
| responses | Replies 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 |
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 |
Undocumented |
Ignore the tool set; the fake just replays its script.
Returning self keeps model.bind_tools(...) chainable like a real model.
async def _agenerate(self, messages:
list[ BaseMessage], stop: list[ str] | None = None, run_manager: AsyncCallbackManagerForLLMRun | None = None, **kwargs: Any) -> ChatResult:
(source)
¶
Undocumented