Home / Function/ mock_async_client() — langchain Function Reference

mock_async_client() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 651–661

def mock_async_client(mock_completion: dict) -> AsyncMock:
    rtn = AsyncMock()

    mock_create = AsyncMock()
    mock_resp = MagicMock()
    mock_resp.parse.return_value = mock_completion
    mock_create.return_value = mock_resp

    rtn.with_raw_response.create = mock_create
    rtn.create.return_value = mock_completion
    return rtn

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free