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

Method retrieve

src/anthropic/resources/models.py:175–218  ·  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

173 return AsyncModelsWithStreamingResponse(self)
174
175 async def retrieve(
176 self,
177 model_id: str,
178 *,
179 betas: List[AnthropicBetaParam] | Omit = omit,
180 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
181 # The extra values given here take precedence over values defined on the client or passed to this method.
182 extra_headers: Headers | None = None,
183 extra_query: Query | None = None,
184 extra_body: Body | None = None,
185 timeout: float | httpx.Timeout | None | NotGiven = not_given,
186 ) -> ModelInfo:
187 """
188 Get a specific model.
189
190 The Models API response can be used to determine information about a specific
191 model or resolve a model alias to a model ID.
192
193 Args:
194 model_id: Model identifier or alias.
195
196 betas: Optional header to specify the beta version(s) you want to use.
197
198 extra_headers: Send extra headers
199
200 extra_query: Add additional query parameters to the request
201
202 extra_body: Add additional JSON properties to the request
203
204 timeout: Override the client-level default timeout for this request, in seconds
205 """
206 if not model_id:
207 raise ValueError(f"Expected a non-empty value for `model_id` but received {model_id!r}")
208 extra_headers = {
209 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
210 **(extra_headers or {}),
211 }
212 return await self._get(
213 path_template("/v1/models/{model_id}", model_id=model_id),
214 options=make_request_options(
215 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
216 ),
217 cast_to=ModelInfo,
218 )
219
220 def list(
221 self,

Callers

nothing calls this directly

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