test_benchmark.py — langchain Source File
Architecture documentation for test_benchmark.py, a python file in the langchain codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5e831729_2795_1f58_ae62_be5b412ef31a["test_benchmark.py"] 0c1d9a1b_c553_0388_dbc1_58af49567aa2["time"] 5e831729_2795_1f58_ae62_be5b412ef31a --> 0c1d9a1b_c553_0388_dbc1_58af49567aa2 436f77bc_653d_0edb_555c_c2679d5a59ac["itertools"] 5e831729_2795_1f58_ae62_be5b412ef31a --> 436f77bc_653d_0edb_555c_c2679d5a59ac ba43b74d_3099_7e1c_aac3_cf594720469e["langchain_core.language_models"] 5e831729_2795_1f58_ae62_be5b412ef31a --> ba43b74d_3099_7e1c_aac3_cf594720469e style 5e831729_2795_1f58_ae62_be5b412ef31a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import time
from itertools import cycle
from langchain_core.language_models import GenericFakeChatModel
def test_benchmark_model() -> None:
"""Add rate limiter."""
tic = time.time()
model = GenericFakeChatModel(
messages=cycle(["hello", "world", "!"]),
)
for _ in range(1_000):
model.invoke("foo")
toc = time.time()
# Verify that the time taken to run the loop is less than 1 seconds
assert (toc - tic) < 1
Domain
Subdomains
Functions
Dependencies
- itertools
- langchain_core.language_models
- time
Source
Frequently Asked Questions
What does test_benchmark.py do?
test_benchmark.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_benchmark.py?
test_benchmark.py defines 1 function(s): test_benchmark_model.
What does test_benchmark.py depend on?
test_benchmark.py imports 3 module(s): itertools, langchain_core.language_models, time.
Where is test_benchmark.py in the architecture?
test_benchmark.py is located at libs/core/tests/unit_tests/language_models/chat_models/test_benchmark.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/core/tests/unit_tests/language_models/chat_models).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free