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

async_transform() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient AsyncAPI calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  7450322a_5cbb_6034_d7f1_29c32ca76e4b["async_transform()"]
  17ea9c01_2df6_304d_71e2_31af17ed7395["_transform.py"]
  7450322a_5cbb_6034_d7f1_29c32ca76e4b -->|defined in| 17ea9c01_2df6_304d_71e2_31af17ed7395
  e1c3a4bf_c5a9_9b2b_ea31_c5cecbc68759["async_maybe_transform()"]
  e1c3a4bf_c5a9_9b2b_ea31_c5cecbc68759 -->|calls| 7450322a_5cbb_6034_d7f1_29c32ca76e4b
  d6615324_bb52_2f02_df89_851d5be298c2["transform()"]
  7450322a_5cbb_6034_d7f1_29c32ca76e4b -->|calls| d6615324_bb52_2f02_df89_851d5be298c2
  6db2b331_e127_3cb2_32c8_72a1730d0041["_async_transform_recursive()"]
  7450322a_5cbb_6034_d7f1_29c32ca76e4b -->|calls| 6db2b331_e127_3cb2_32c8_72a1730d0041
  style 7450322a_5cbb_6034_d7f1_29c32ca76e4b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_transform.py lines 297–317

async def async_transform(
    data: _T,
    expected_type: object,
) -> _T:
    """Transform dictionaries based off of type information from the given type, for example:

    ```py
    class Params(TypedDict, total=False):
        card_id: Required[Annotated[str, PropertyInfo(alias="cardID")]]


    transformed = transform({"card_id": "<my card ID>"}, Params)
    # {'cardID': '<my card ID>'}
    ```

    Any keys / data that does not have type information given will be included as is.

    It should be noted that the transformations that this function does are not represented in the type system.
    """
    transformed = await _async_transform_recursive(data, annotation=cast(type, expected_type))
    return cast(_T, transformed)

Subdomains

Frequently Asked Questions

What does async_transform() do?
async_transform() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_transform.py.
Where is async_transform() defined?
async_transform() is defined in src/anthropic/_utils/_transform.py at line 297.
What does async_transform() call?
async_transform() calls 2 function(s): _async_transform_recursive, transform.
What calls async_transform()?
async_transform() is called by 1 function(s): async_maybe_transform.

Analyze Your Own Codebase

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

Try Supermodel Free