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
  6250089c_e1d4_68d4_4698_afa974d8246a["test_stream_usage()"]
  ab81c312_5936_dad3_e4e1_2c0bdf796471["test_chat_models.py"]
  6250089c_e1d4_68d4_4698_afa974d8246a -->|defined in| ab81c312_5936_dad3_e4e1_2c0bdf796471
  style 6250089c_e1d4_68d4_4698_afa974d8246a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/huggingface/tests/integration_tests/test_chat_models.py lines 6–22

def test_stream_usage() -> None:
    """Test we are able to configure stream options on models that require it."""
    llm = HuggingFaceEndpoint(  # type: ignore[call-arg]  # (model is inferred in class)
        repo_id="google/gemma-3-27b-it",
        task="conversational",
        provider="nebius",
    )

    model = ChatHuggingFace(llm=llm, stream_usage=True)

    full: AIMessageChunk | None = None
    for chunk in model.stream("hello"):
        assert isinstance(chunk, AIMessageChunk)
        full = chunk if full is None else full + chunk

    assert isinstance(full, AIMessageChunk)
    assert full.usage_metadata

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/huggingface/tests/integration_tests/test_chat_models.py.
Where is test_stream_usage() defined?
test_stream_usage() is defined in libs/partners/huggingface/tests/integration_tests/test_chat_models.py at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free