Home / File/ models.py — anthropic-sdk-python Source File

models.py — anthropic-sdk-python Source File

Architecture documentation for models.py, a python file in the anthropic-sdk-python codebase. 13 imports, 1 dependents.

File python AnthropicClient AsyncAPI 13 imports 1 dependents 6 classes

Entity Profile

Dependency Diagram

graph LR
  4a949196_7222_6f5f_da12_31c9260bb10f["models.py"]
  711d3916_d5a7_c3e4_d380_e4745361142d["711d3916:d5a7:c3e4:d380:e4745361142d"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 711d3916_d5a7_c3e4_d380_e4745361142d
  bbb75a75_73e0_c1d2_8fe4_5dfd52f08af9["types"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> bbb75a75_73e0_c1d2_8fe4_5dfd52f08af9
  44e25172_a38e_964d_ff57_c147e3ff3ded["_types"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 44e25172_a38e_964d_ff57_c147e3ff3ded
  05bc2426_c4bc_3210_d02a_17f0f58e9392["_utils"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 05bc2426_c4bc_3210_d02a_17f0f58e9392
  f1ff822f_349c_67ee_8cd9_573fb95c18a4["_compat"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> f1ff822f_349c_67ee_8cd9_573fb95c18a4
  833cd20e_92cf_69d7_2d6b_af3c0a15e606["_resource"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 833cd20e_92cf_69d7_2d6b_af3c0a15e606
  45e6e669_bb0f_ca05_f8e3_7f4636fe70c4["_response"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 45e6e669_bb0f_ca05_f8e3_7f4636fe70c4
  199152cf_49d5_4da7_060f_9a540e596cc8["pagination"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 199152cf_49d5_4da7_060f_9a540e596cc8
  a1b46bdc_f0c1_ce7a_0c91_5c0ac0a06444["_base_client"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> a1b46bdc_f0c1_ce7a_0c91_5c0ac0a06444
  f359c39d_20da_371e_cb71_3526bb5b2f21["types.model_info"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> f359c39d_20da_371e_cb71_3526bb5b2f21
  00ed9528_03de_7d03_0ffb_672ff72a0ec6["types.anthropic_beta_param"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 00ed9528_03de_7d03_0ffb_672ff72a0ec6
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  9c26e8a9_1ad2_1174_876a_1fc500ce0eaf["httpx"]
  4a949196_7222_6f5f_da12_31c9260bb10f --> 9c26e8a9_1ad2_1174_876a_1fc500ce0eaf
  48bcc20e_babc_e84d_5930_20cba9e79312["__init__.py"]
  48bcc20e_babc_e84d_5930_20cba9e79312 --> 4a949196_7222_6f5f_da12_31c9260bb10f
  style 4a949196_7222_6f5f_da12_31c9260bb10f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List

import httpx

from .. import _legacy_response
from ..types import model_list_params
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._utils import is_given, maybe_transform, strip_not_given
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ..pagination import SyncPage, AsyncPage
from .._base_client import AsyncPaginator, make_request_options
from ..types.model_info import ModelInfo
from ..types.anthropic_beta_param import AnthropicBetaParam

__all__ = ["Models", "AsyncModels"]


class Models(SyncAPIResource):
    @cached_property
    def with_raw_response(self) -> ModelsWithRawResponse:
        """
        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 ModelsWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> ModelsWithStreamingResponse:
        """
        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 ModelsWithStreamingResponse(self)

    def retrieve(
        self,
        model_id: str,
        *,
        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,
    ) -> ModelInfo:
        """
        Get a specific model.

        The Models API response can be used to determine information about a specific
        model or resolve a model alias to a model ID.
// ... (272 more lines)

Subdomains

Dependencies

  • 711d3916:d5a7:c3e4:d380:e4745361142d
  • _base_client
  • _compat
  • _resource
  • _response
  • _types
  • _utils
  • httpx
  • pagination
  • types
  • types.anthropic_beta_param
  • types.model_info
  • typing

Frequently Asked Questions

What does models.py do?
models.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, AsyncAPI subdomain.
What does models.py depend on?
models.py imports 13 module(s): 711d3916:d5a7:c3e4:d380:e4745361142d, _base_client, _compat, _resource, _response, _types, _utils, httpx, and 5 more.
What files import models.py?
models.py is imported by 1 file(s): __init__.py.
Where is models.py in the architecture?
models.py is located at src/anthropic/resources/models.py (domain: AnthropicClient, subdomain: AsyncAPI, directory: src/anthropic/resources).

Analyze Your Own Codebase

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

Try Supermodel Free