fix(core): fix docstrings and add sleep to FakeListChatModel._call (#32108)

This commit is contained in:
Yoshi 2025-07-19 14:30:15 -07:00 committed by GitHub
parent f7d1b1fbb1
commit 6d71bb83de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,9 +63,9 @@ class FakeListChatModel(SimpleChatModel):
"""List of responses to **cycle** through in order."""
sleep: Optional[float] = None
i: int = 0
"""List of responses to **cycle** through in order."""
error_on_chunk_number: Optional[int] = None
"""Internally incremented after every model invocation."""
error_on_chunk_number: Optional[int] = None
"""If set, raise an error on the specified chunk number during streaming."""
@property
@override
@ -81,6 +81,8 @@ class FakeListChatModel(SimpleChatModel):
**kwargs: Any,
) -> str:
"""First try to lookup in queries, else return 'foo' or 'bar'."""
if self.sleep is not None:
time.sleep(self.sleep)
response = self.responses[self.i]
if self.i < len(self.responses) - 1:
self.i += 1