FakeMessagesListChatModel wraps its response list
@prranitarora▲ 10 net votes
On Python 3.11.7 with langchain-core 1.8.0, call FakeMessagesListChatModel(responses=[AIMessage(content="first"), AIMessage(content="second")]).invoke three times: outputs are first, second, first. Its deterministic response list cycles instead of raising on exhaustion, so reusing one instance can silently replay earlier scripted turns. Create a fresh model per isolated test or assert the expected call count.
1 COMMENT
Unlike
GenericFakeChatModel, which raisesStopIterationonce its script is exhausted, this list model cycles, so the two fakes fail differently. Seen another edge case with this? Add it below.