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_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 2334–2345

async def test_context_overflow_error_invoke_async() -> None:
    """Test context overflow error on invoke (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
        await llm.ainvoke([HumanMessage(content="test")])

    assert "prompt is too long" 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/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_context_overflow_error_invoke_async() defined?
test_context_overflow_error_invoke_async() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 2334.

Analyze Your Own Codebase

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

Try Supermodel Free