Home / Class/ Files Class — anthropic-sdk-python Architecture

Files Class — anthropic-sdk-python Architecture

Architecture documentation for the Files class in files.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  3e08ebfe_73a6_0f3e_2027_4a081297bec5["Files"]
  32bd9d9e_8b62_b229_7718_45771b424c40["SyncAPIResource"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|extends| 32bd9d9e_8b62_b229_7718_45771b424c40
  8eb6ac96_326e_83d2_aa95_9071b1193d06["files.py"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|defined in| 8eb6ac96_326e_83d2_aa95_9071b1193d06
  32d5c7d9_02b8_7da8_d65c_f2d59a40708c["with_raw_response()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| 32d5c7d9_02b8_7da8_d65c_f2d59a40708c
  2aa87eba_27e0_3445_7f42_e2bdcdc0f3ec["with_streaming_response()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| 2aa87eba_27e0_3445_7f42_e2bdcdc0f3ec
  28ffd32a_8ed5_78cd_f171_82d020731840["list()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| 28ffd32a_8ed5_78cd_f171_82d020731840
  ab836168_6b3b_69c8_39b3_b11abd7bf9f1["delete()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| ab836168_6b3b_69c8_39b3_b11abd7bf9f1
  ca412e60_cf71_54b9_c22f_d8dcf16bd8a9["download()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| ca412e60_cf71_54b9_c22f_d8dcf16bd8a9
  ea9d3c15_7241_6c3a_41fc_a9e07cc1b954["retrieve_metadata()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| ea9d3c15_7241_6c3a_41fc_a9e07cc1b954
  3dbef1a4_a354_5bb8_2fe0_82cae8d90ec8["upload()"]
  3e08ebfe_73a6_0f3e_2027_4a081297bec5 -->|method| 3dbef1a4_a354_5bb8_2fe0_82cae8d90ec8

Relationship Graph

Source Code

src/anthropic/resources/beta/files.py lines 37–328

class Files(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> FilesWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        """
        return FilesWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> FilesWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        """
        return FilesWithStreamingResponse(self)

    def list(
        self,
        *,
        after_id: str | Omit = omit,
        before_id: str | Omit = omit,
        limit: int | Omit = omit,
        betas: List[AnthropicBetaParam] | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    ) -> SyncPage[FileMetadata]:
        """List Files

        Args:
          after_id: ID of the object to use as a cursor for pagination.

        When provided, returns the
              page of results immediately after this object.

          before_id: ID of the object to use as a cursor for pagination. When provided, returns the
              page of results immediately before this object.

          limit: Number of items to return per page.

              Defaults to `20`. Ranges from `1` to `1000`.

          betas: Optional header to specify the beta version(s) you want to use.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        extra_headers = {
            **strip_not_given(
                {
                    "anthropic-beta": ",".join(chain((str(e) for e in betas), ["files-api-2025-04-14"]))
                    if is_given(betas)
                    else not_given
                }
            ),
            **(extra_headers or {}),
        }
        extra_headers = {"anthropic-beta": "files-api-2025-04-14", **(extra_headers or {})}
        return self._get_api_list(
            "/v1/files?beta=true",
            page=SyncPage[FileMetadata],
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {
                        "after_id": after_id,

Extends

Frequently Asked Questions

What is the Files class?
Files is a class in the anthropic-sdk-python codebase, defined in src/anthropic/resources/beta/files.py.
Where is Files defined?
Files is defined in src/anthropic/resources/beta/files.py at line 37.
What does Files extend?
Files extends SyncAPIResource.

Analyze Your Own Codebase

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

Try Supermodel Free