test_rate_limit_batch() — langchain Function Reference
Architecture documentation for the test_rate_limit_batch() function in test_rate_limiting.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 539f9785_307b_3075_90c3_fcc73ef409c3["test_rate_limit_batch()"] df01695c_1dbe_973d_756a_a5cd86e49330["test_rate_limiting.py"] 539f9785_307b_3075_90c3_fcc73ef409c3 -->|defined in| df01695c_1dbe_973d_756a_a5cd86e49330 style 539f9785_307b_3075_90c3_fcc73ef409c3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/language_models/chat_models/test_rate_limiting.py lines 78–92
def test_rate_limit_batch() -> None:
"""Test that batch and stream calls work with rate limiters."""
model = GenericFakeChatModel(
messages=iter(["hello", "world", "!"]),
rate_limiter=InMemoryRateLimiter(
requests_per_second=20,
check_every_n_seconds=0.01,
max_bucket_size=10,
# At 20 requests per second we see a refresh every 0.05 seconds
),
)
tic = time.time()
model.batch(["foo", "foo"])
toc = time.time()
assert 0.1 < toc - tic < 0.2
Domain
Subdomains
Source
Frequently Asked Questions
What does test_rate_limit_batch() do?
test_rate_limit_batch() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_rate_limiting.py.
Where is test_rate_limit_batch() defined?
test_rate_limit_batch() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_rate_limiting.py at line 78.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free