FakeListLLM Class — langchain Architecture
Architecture documentation for the FakeListLLM class in test_agent_async.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5e48d5ad_3c90_c6d2_0771_5a91135f0368["FakeListLLM"] b2c7d2a5_0852_93df_c3e1_828c36a88999["LLM"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|extends| b2c7d2a5_0852_93df_c3e1_828c36a88999 663245d2_2254_328f_5cf8_4bbd36fb32cc["test_agent_async.py"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|defined in| 663245d2_2254_328f_5cf8_4bbd36fb32cc e1229f89_eee9_3bdb_abcd_de36ec90f784["_call()"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|method| e1229f89_eee9_3bdb_abcd_de36ec90f784 e8dfeb95_9916_80b3_e96a_21d612381a0f["get_num_tokens()"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|method| e8dfeb95_9916_80b3_e96a_21d612381a0f 20e0f822_0b97_1cd6_86f0_e34565beba8f["_acall()"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|method| 20e0f822_0b97_1cd6_86f0_e34565beba8f 7be64a09_32fc_6b10_8d1c_0672ac351a83["_identifying_params()"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|method| 7be64a09_32fc_6b10_8d1c_0672ac351a83 234b6fe7_37a8_4b2a_92db_54ef41214774["_llm_type()"] 5e48d5ad_3c90_c6d2_0771_5a91135f0368 -->|method| 234b6fe7_37a8_4b2a_92db_54ef41214774
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent_async.py lines 17–51
class FakeListLLM(LLM):
"""Fake LLM for testing that outputs elements of a list."""
responses: list[str]
i: int = -1
@override
def _call(
self,
prompt: str,
stop: list[str] | None = None,
run_manager: CallbackManagerForLLMRun | None = None,
**kwargs: Any,
) -> str:
"""Increment counter, and then return response in that index."""
self.i += 1
print(f"=== Mock Response #{self.i} ===") # noqa: T201
print(self.responses[self.i]) # noqa: T201
return self.responses[self.i]
def get_num_tokens(self, text: str) -> int:
"""Return number of tokens in text."""
return len(text.split())
async def _acall(self, *args: Any, **kwargs: Any) -> str:
return self._call(*args, **kwargs)
@property
def _identifying_params(self) -> dict[str, Any]:
return {}
@property
def _llm_type(self) -> str:
"""Return type of llm."""
return "fake_list"
Extends
Source
Frequently Asked Questions
What is the FakeListLLM class?
FakeListLLM is a class in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py.
Where is FakeListLLM defined?
FakeListLLM is defined in libs/langchain/tests/unit_tests/agents/test_agent_async.py at line 17.
What does FakeListLLM extend?
FakeListLLM extends LLM.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free