Home / File/ test_chat_models.py — langchain Source File

test_chat_models.py — langchain Source File

Architecture documentation for test_chat_models.py, a python file in the langchain codebase. 2 imports, 0 dependents.

File python CoreAbstractions MessageSchema 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  618c55b2_94e7_cbce_2527_81f5b0664f2a["test_chat_models.py"]
  d758344f_537f_649e_f467_b9d7442e86df["langchain_core.messages"]
  618c55b2_94e7_cbce_2527_81f5b0664f2a --> d758344f_537f_649e_f467_b9d7442e86df
  4764ca37_d94c_f8b7_54d8_c5b326fc9488["langchain_huggingface"]
  618c55b2_94e7_cbce_2527_81f5b0664f2a --> 4764ca37_d94c_f8b7_54d8_c5b326fc9488
  style 618c55b2_94e7_cbce_2527_81f5b0664f2a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.messages import AIMessageChunk

from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint


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

Subdomains

Dependencies

  • langchain_core.messages
  • langchain_huggingface

Frequently Asked Questions

What does test_chat_models.py do?
test_chat_models.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What functions are defined in test_chat_models.py?
test_chat_models.py defines 1 function(s): test_stream_usage.
What does test_chat_models.py depend on?
test_chat_models.py imports 2 module(s): langchain_core.messages, langchain_huggingface.
Where is test_chat_models.py in the architecture?
test_chat_models.py is located at libs/partners/huggingface/tests/integration_tests/test_chat_models.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/partners/huggingface/tests/integration_tests).

Analyze Your Own Codebase

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

Try Supermodel Free