Home / Function/ test_context_overflow_error_stream_async() — langchain Function Reference

test_context_overflow_error_stream_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  626d79d3_a248_d1e4_8c5f_9f6421406ea2["test_context_overflow_error_stream_async()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  626d79d3_a248_d1e4_8c5f_9f6421406ea2 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style 626d79d3_a248_d1e4_8c5f_9f6421406ea2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 2362–2374

async def test_context_overflow_error_stream_async() -> None:
    """Test context overflow error on stream (async)."""
    llm = ChatAnthropic(model=MODEL_NAME)

    with (  # noqa: PT012
        patch.object(llm._async_client.messages, "create") as mock_create,
        pytest.raises(ContextOverflowError) as exc_info,
    ):
        mock_create.side_effect = _CONTEXT_OVERFLOW_BAD_REQUEST_ERROR
        async for _ in llm.astream([HumanMessage(content="test")]):
            pass

    assert "prompt is too long" in str(exc_info.value)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free