Home / Function/ test_stream_usage() — langchain Function Reference

test_stream_usage() — langchain Function Reference

Architecture documentation for the test_stream_usage() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3921075b_37b7_877c_2afe_737f5aa48346["test_stream_usage()"]
  f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"]
  3921075b_37b7_877c_2afe_737f5aa48346 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f
  style 3921075b_37b7_877c_2afe_737f5aa48346 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 149–154

async def test_stream_usage() -> None:
    """Test usage metadata can be excluded."""
    model = ChatAnthropic(model_name=MODEL_NAME, stream_usage=False)  # type: ignore[call-arg]
    async for token in model.astream("hi"):
        assert isinstance(token, AIMessageChunk)
        assert token.usage_metadata is None

Domain

Subdomains

Frequently Asked Questions

What does test_stream_usage() do?
test_stream_usage() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_stream_usage() defined?
test_stream_usage() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 149.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free