Home / Function/ test_huggingface_pipeline_streaming() — langchain Function Reference

test_huggingface_pipeline_streaming() — langchain Function Reference

Architecture documentation for the test_huggingface_pipeline_streaming() function in test_llms.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d9f7d646_a847_edb5_84a9_4de0678011ba["test_huggingface_pipeline_streaming()"]
  eea07ad0_e97a_d7eb_7374_e8de0cf9c327["test_llms.py"]
  d9f7d646_a847_edb5_84a9_4de0678011ba -->|defined in| eea07ad0_e97a_d7eb_7374_e8de0cf9c327
  style d9f7d646_a847_edb5_84a9_4de0678011ba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/huggingface/tests/integration_tests/test_llms.py lines 6–20

def test_huggingface_pipeline_streaming() -> None:
    """Test streaming tokens from huggingface_pipeline."""
    llm = HuggingFacePipeline.from_model_id(
        model_id="openai-community/gpt2",
        task="text-generation",
        pipeline_kwargs={"max_new_tokens": 10},
    )
    generator = llm.stream("Q: How do you say 'hello' in German? A:'", stop=["."])
    stream_results_string = ""
    assert isinstance(generator, Generator)

    for chunk in generator:
        assert isinstance(chunk, str)
        stream_results_string = chunk
    assert len(stream_results_string.strip()) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_huggingface_pipeline_streaming() do?
test_huggingface_pipeline_streaming() is a function in the langchain codebase, defined in libs/partners/huggingface/tests/integration_tests/test_llms.py.
Where is test_huggingface_pipeline_streaming() defined?
test_huggingface_pipeline_streaming() is defined in libs/partners/huggingface/tests/integration_tests/test_llms.py at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free