mirror of
https://github.com/hwchase17/langchain
synced 2024-11-11 19:11:02 +00:00
6c07eb0c12
Adding `UpstashRatelimitHandler` callback for rate limiting based on number of chain invocations or LLM token usage. For more details, see [upstash/ratelimit-py repository](https://github.com/upstash/ratelimit-py) or the notebook guide included in this PR. Twitter handle: @cahidarda --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from langchain_community.callbacks import __all__, _module_lookup
|
|
|
|
EXPECTED_ALL = [
|
|
"AimCallbackHandler",
|
|
"ArgillaCallbackHandler",
|
|
"ArizeCallbackHandler",
|
|
"PromptLayerCallbackHandler",
|
|
"ArthurCallbackHandler",
|
|
"ClearMLCallbackHandler",
|
|
"CometCallbackHandler",
|
|
"ContextCallbackHandler",
|
|
"HumanApprovalCallbackHandler",
|
|
"InfinoCallbackHandler",
|
|
"MlflowCallbackHandler",
|
|
"LLMonitorCallbackHandler",
|
|
"OpenAICallbackHandler",
|
|
"LLMThoughtLabeler",
|
|
"StreamlitCallbackHandler",
|
|
"WandbCallbackHandler",
|
|
"WhyLabsCallbackHandler",
|
|
"get_openai_callback",
|
|
"wandb_tracing_enabled",
|
|
"FlyteCallbackHandler",
|
|
"SageMakerCallbackHandler",
|
|
"LabelStudioCallbackHandler",
|
|
"TrubricsCallbackHandler",
|
|
"FiddlerCallbackHandler",
|
|
"UpTrainCallbackHandler",
|
|
"UpstashRatelimitError",
|
|
"UpstashRatelimitHandler",
|
|
]
|
|
|
|
|
|
def test_all_imports() -> None:
|
|
"""Test that __all__ is correctly set."""
|
|
assert set(__all__) == set(EXPECTED_ALL)
|
|
assert set(__all__) == set(_module_lookup.keys())
|