MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / retrieve

Method retrieve

src/anthropic/resources/models.py:44–87  ·  view source on GitHub ↗

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. Args: model_id: Model identifier or alias. betas: Optional header to specify the beta version(s) y

(
        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,
    )

Source from the content-addressed store, hash-verified

42 return ModelsWithStreamingResponse(self)
43
44 def retrieve(
45 self,
46 model_id: str,
47 *,
48 betas: List[AnthropicBetaParam] | Omit = omit,
49 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
50 # The extra values given here take precedence over values defined on the client or passed to this method.
51 extra_headers: Headers | None = None,
52 extra_query: Query | None = None,
53 extra_body: Body | None = None,
54 timeout: float | httpx.Timeout | None | NotGiven = not_given,
55 ) -> ModelInfo:
56 """
57 Get a specific model.
58
59 The Models API response can be used to determine information about a specific
60 model or resolve a model alias to a model ID.
61
62 Args:
63 model_id: Model identifier or alias.
64
65 betas: Optional header to specify the beta version(s) you want to use.
66
67 extra_headers: Send extra headers
68
69 extra_query: Add additional query parameters to the request
70
71 extra_body: Add additional JSON properties to the request
72
73 timeout: Override the client-level default timeout for this request, in seconds
74 """
75 if not model_id:
76 raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
77 extra_headers = {
78 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
79 **(extra_headers or {}),
80 }
81 return self._get(
82 path_template("/v1/models/{model_id}", model_id=model_id),
83 options=make_request_options(
84 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
85 ),
86 cast_to=ModelInfo,
87 )
88
89 def list(
90 self,

Callers 1

download_session_skillsFunction · 0.45

Calls 4

strip_not_givenFunction · 0.85
is_givenFunction · 0.85
path_templateFunction · 0.85
make_request_optionsFunction · 0.85

Tested by

no test coverage detected