Home / Function/ test_disable_streaming_async() — langchain Function Reference

test_disable_streaming_async() — langchain Function Reference

Architecture documentation for the test_disable_streaming_async() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0ec3ddf5_9695_9ea1_cde9_8f3bb95d8f45["test_disable_streaming_async()"]
  8cb88ac4_61d9_baf3_9df4_9b3f5095927e["test_base.py"]
  0ec3ddf5_9695_9ea1_cde9_8f3bb95d8f45 -->|defined in| 8cb88ac4_61d9_baf3_9df4_9b3f5095927e
  style 0ec3ddf5_9695_9ea1_cde9_8f3bb95d8f45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/language_models/chat_models/test_base.py lines 408–431

async def test_disable_streaming_async(
    *,
    disable_streaming: bool | Literal["tool_calling"],
) -> None:
    model = StreamingModel(disable_streaming=disable_streaming)
    assert (await model.ainvoke([])).content == "invoke"

    expected = "invoke" if disable_streaming is True else "stream"
    async for c in model.astream([]):
        assert c.content == expected
        break
    assert (
        await model.ainvoke([], config={"callbacks": [_AstreamEventsCallbackHandler()]})
    ).content == expected

    expected = "invoke" if disable_streaming in {"tool_calling", True} else "stream"
    async for c in model.astream([], tools=[{}]):
        assert c.content == expected
        break
    assert (
        await model.ainvoke(
            [], config={"callbacks": [_AstreamEventsCallbackHandler()]}, tools=[{}]
        )
    ).content == expected

Domain

Subdomains

Frequently Asked Questions

What does test_disable_streaming_async() do?
test_disable_streaming_async() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py.
Where is test_disable_streaming_async() defined?
test_disable_streaming_async() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py at line 408.

Analyze Your Own Codebase

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

Try Supermodel Free