test_anthropic_streaming_callback() — langchain Function Reference
Architecture documentation for the test_anthropic_streaming_callback() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 92fd8d98_306a_2702_dd09_68877b174874["test_anthropic_streaming_callback()"] f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"] 92fd8d98_306a_2702_dd09_68877b174874 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f style 92fd8d98_306a_2702_dd09_68877b174874 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 365–378
def test_anthropic_streaming_callback() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler()
callback_manager = CallbackManager([callback_handler])
chat = ChatAnthropic(
model=MODEL_NAME, # type: ignore[call-arg]
callbacks=callback_manager,
verbose=True,
)
message = HumanMessage(content="Write me a sentence with 10 words.")
for token in chat.stream([message]):
assert isinstance(token, AIMessageChunk)
assert isinstance(token.content, str)
assert callback_handler.llm_streams > 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_anthropic_streaming_callback() do?
test_anthropic_streaming_callback() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_anthropic_streaming_callback() defined?
test_anthropic_streaming_callback() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 365.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free