Home / Function/ test_context_overflow_error_invoke_async() — langchain Function Reference

test_context_overflow_error_invoke_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3293–3304

async def test_context_overflow_error_invoke_async() -> None:
    """Test context overflow error on invoke (async, chat completions API)."""
    llm = ChatOpenAI()

    with (  # noqa: PT012
        patch.object(llm.async_client, "with_raw_response") as mock_client,
        pytest.raises(ContextOverflowError) as exc_info,
    ):
        mock_client.create.side_effect = _CONTEXT_OVERFLOW_BAD_REQUEST_ERROR
        await llm.ainvoke([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_invoke_async() do?
test_context_overflow_error_invoke_async() 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_invoke_async() defined?
test_context_overflow_error_invoke_async() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 3293.

Analyze Your Own Codebase

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

Try Supermodel Free