Home / Function/ async_client() — anthropic-sdk-python Function Reference

async_client() — anthropic-sdk-python Function Reference

Architecture documentation for the async_client() function in conftest.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  26085ea1_f486_ed3f_a9a3_cdaee7efea09["async_client()"]
  68a6e880_ca4a_fcf0_511e_42d9fe42570f["conftest.py"]
  26085ea1_f486_ed3f_a9a3_cdaee7efea09 -->|defined in| 68a6e880_ca4a_fcf0_511e_42d9fe42570f
  style 26085ea1_f486_ed3f_a9a3_cdaee7efea09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/conftest.py lines 62–84

async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncAnthropic]:
    param = getattr(request, "param", True)

    # defaults
    strict = True
    http_client: None | httpx.AsyncClient = None

    if isinstance(param, bool):
        strict = param
    elif is_dict(param):
        strict = param.get("strict", True)
        assert isinstance(strict, bool)

        http_client_type = param.get("http_client", "httpx")
        if http_client_type == "aiohttp":
            http_client = DefaultAioHttpClient()
    else:
        raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict")

    async with AsyncAnthropic(
        base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client
    ) as client:
        yield client

Subdomains

Defined In

Frequently Asked Questions

What does async_client() do?
async_client() is a function in the anthropic-sdk-python codebase, defined in tests/conftest.py.
Where is async_client() defined?
async_client() is defined in tests/conftest.py at line 62.

Analyze Your Own Codebase

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

Try Supermodel Free