_async_transform_file() — anthropic-sdk-python Function Reference
Architecture documentation for the _async_transform_file() function in _files.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 16b69ffb_6315_25b3_9277_046f63726ab9["_async_transform_file()"] b816976e_26cb_0c66_3616_ca36993ea7c2["_files.py"] 16b69ffb_6315_25b3_9277_046f63726ab9 -->|defined in| b816976e_26cb_0c66_3616_ca36993ea7c2 519a179d_9f23_ac23_2b85_6c27451e5039["async_to_httpx_files()"] 519a179d_9f23_ac23_2b85_6c27451e5039 -->|calls| 16b69ffb_6315_25b3_9277_046f63726ab9 f643e3cc_91b8_ddc8_7cec_b44ab07f3931["is_file_content()"] 16b69ffb_6315_25b3_9277_046f63726ab9 -->|calls| f643e3cc_91b8_ddc8_7cec_b44ab07f3931 72409b22_9997_5b31_21ee_2271c4d40eeb["async_read_file_content()"] 16b69ffb_6315_25b3_9277_046f63726ab9 -->|calls| 72409b22_9997_5b31_21ee_2271c4d40eeb style 16b69ffb_6315_25b3_9277_046f63726ab9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_files.py lines 105–116
async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
if is_file_content(file):
if isinstance(file, os.PathLike):
path = anyio.Path(file)
return (path.name, await path.read_bytes())
return file
if is_tuple_t(file):
return (file[0], await async_read_file_content(file[1]), *file[2:])
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _async_transform_file() do?
_async_transform_file() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_files.py.
Where is _async_transform_file() defined?
_async_transform_file() is defined in src/anthropic/_files.py at line 105.
What does _async_transform_file() call?
_async_transform_file() calls 2 function(s): async_read_file_content, is_file_content.
What calls _async_transform_file()?
_async_transform_file() is called by 1 function(s): async_to_httpx_files.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free