DeterministicIntegrationChatModel()_ToolBindingFakeModelDeterministic chat model for integration tests.
This subclasses _ToolBindingFakeModel (itself a GenericFakeChatModel) so
the implementation stays aligned with the core fake-chat-model test surface,
while overriding generation to remain prompt-driven and restart-safe for real
CLI server integration tests.
Why the existing langchain_core fakes cannot be reused here:
Every core fake (GenericFakeChatModel, FakeListChatModel,
FakeMessagesListChatModel) pops from an iterator or cycles an index —
the actual prompt is ignored. App integration tests start and stop the
server process, which resets in-memory state. An iterator-based model
either raises StopIteration or replays from the beginning after a
restart, producing wrong or missing responses. This model derives output
solely from the prompt text, so identical input always produces
identical output regardless of process lifecycle.
The agent runtime calls model.bind_tools(schemas) during
initialization. A bare GenericFakeChatModel inherits
BaseChatModel.bind_tools, which raises NotImplementedError in any
agent-loop context. The inherited _ToolBindingFakeModel supplies a
no-op passthrough.
The app server reads model.profile for capability negotiation (e.g.
tool_calling, max_input_tokens). A bare fake's profile is None,
causing silent misconfiguration at runtime. The inherited
_ToolBindingFakeModel supplies a minimal profile.
Additionally, the compact middleware issues summarization prompts mid- conversation. A list-based model cannot distinguish these from normal user turns without pre-knowledge of exact call ordering, whereas this model detects summary requests by inspecting the prompt content.