Home / Function/ test_context_overflow_error_stream_sync() — langchain Function Reference

test_context_overflow_error_stream_sync() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  ca36f311_7c03_398b_25a9_a0dd8921cf56["test_context_overflow_error_stream_sync()"]
  48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"]
  ca36f311_7c03_398b_25a9_a0dd8921cf56 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5
  style ca36f311_7c03_398b_25a9_a0dd8921cf56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3323–3334

def test_context_overflow_error_stream_sync() -> None:
    """Test context overflow error on stream (sync, chat completions API)."""
    llm = ChatOpenAI()

    with (  # noqa: PT012
        patch.object(llm.client, "create") as mock_create,
        pytest.raises(ContextOverflowError) as exc_info,
    ):
        mock_create.side_effect = _CONTEXT_OVERFLOW_BAD_REQUEST_ERROR
        list(llm.stream([HumanMessage(content="test")]))

    assert "Input tokens exceed the configured limit" in str(exc_info.value)

Domain

Subdomains

Frequently Asked Questions

What does test_context_overflow_error_stream_sync() do?
test_context_overflow_error_stream_sync() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_context_overflow_error_stream_sync() defined?
test_context_overflow_error_stream_sync() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 3323.

Analyze Your Own Codebase

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

Try Supermodel Free