MCPcopy Create free account

hub / github.com/anthropics/anthropic-sdk-python / functions

Functions1,183 in github.com/anthropics/anthropic-sdk-python

↓ 174 callersMethodget
(self, __key: str)
src/anthropic/_types.py:172
↓ 141 callersFunctionassert_matches_type
( type_: Any, value: object, *, path: list[str], allow_none: bool = False, )
tests/utils.py:48
↓ 89 callersMethodparse
(self, query: str)
src/anthropic/_qs.py:36
↓ 88 callersMethodcreate
[Legacy] Create a Text Completion. The Text Completions API is a legacy API. We recommend using the [Messages API](https://d
src/anthropic/resources/completions.py:53
↓ 73 callersMethodconstruct
( # pyright: ignore[reportIncompatibleMethodOverride] __cls: Type[ModelT], _fields_set: set[s
src/anthropic/_models.py:197
↓ 50 callersFunctionmake_request_options
Create a dict of type RequestOptions without keys of NotGiven values.
src/anthropic/_base_client.py:1900
↓ 39 callersFunctionis_given
(obj: NotGivenOr[_T])
src/anthropic/_utils/_utils.py:122
↓ 34 callersMethodretrieve
Get a specific model. The Models API response can be used to determine information about a specific model or resolve a model
src/anthropic/resources/models.py:41
↓ 32 callersMethodlist
List available models. The Models API response can be used to determine which models are available for use in the API. More
src/anthropic/resources/models.py:79
↓ 31 callersMethod_build_request
( self, options: FinalRequestOptions, *, retries_taken: int = 0, )
src/anthropic/_base_client.py:445
↓ 29 callersMethodpost
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1231
↓ 24 callersFunctiontransform
( data: _T, expected_type: object, use_async: bool, )
tests/test_transform.py:26
↓ 20 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_streaming.py:131
↓ 19 callersFunctionmaybe_transform
Wrapper over `transform()` that allows `None` to be passed. See `transform()` for more details.
src/anthropic/_utils/_transform.py:74
↓ 19 callersFunctionstrip_not_given
(obj: None)
src/anthropic/_utils/_utils.py:287
↓ 18 callersMethodcancel
Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at whi
src/anthropic/resources/messages/batches.py:222
↓ 18 callersMethoddelete
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1309
↓ 16 callersMethodcount_tokens
Count the number of tokens in a Message. The Token Count API can be used to count the number of tokens in a Message, includi
src/anthropic/resources/messages/messages.py:993
↓ 16 callersMethodjson
Read and decode the JSON response content.
src/anthropic/_response.py:372
↓ 15 callersFunctionconstruct_type
Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned a
src/anthropic/_models.py:440
↓ 15 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:184
↓ 14 callersFunctionget_origin
(t: type[Any])
src/anthropic/_compat.py:37
↓ 12 callersMethodaclose
(self)
src/anthropic/_legacy_response.py:510
↓ 12 callersFunctionget_args
(t: type[Any])
src/anthropic/_compat.py:31
↓ 11 callersFunctioniter_next
(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent])
tests/test_streaming.py:232
↓ 11 callersMethodread
Read and return the binary response content.
src/anthropic/_response.py:357
↓ 10 callersFunctionbody
()
tests/test_streaming.py:15
↓ 10 callersFunctionmake_event_iterator
( content: Iterator[bytes], *, sync: bool, client: Anthropic, async_client: AsyncAnthropic
tests/test_streaming.py:244
↓ 10 callersMethodto_dict
Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. By default, fields t
src/anthropic/_models.py:115
↓ 9 callersFunctionassert_empty_iter
(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent])
tests/test_streaming.py:239
↓ 9 callersFunctionasync_to_streamed_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support streaming and returning the raw `APIResponse` object directl
src/anthropic/_response.py:706
↓ 9 callersMethoddecode
(self, line: str)
src/anthropic/_streaming.py:355
↓ 9 callersMethodget
( self, path: str, *, cast_to: Type[ResponseT], options: RequestOption
src/anthropic/_base_client.py:1185
↓ 9 callersMethodstream
Create a Message stream
src/anthropic/resources/messages/messages.py:931
↓ 9 callersFunctionto_streamed_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support streaming and returning the raw `APIResponse` object directl
src/anthropic/_response.py:687
↓ 8 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_response.py:304
↓ 8 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_response.py:413
↓ 7 callersFunctionasync_maybe_transform
Wrapper over `async_transform()` that allows `None` to be passed. See `async_transform()` for more details.
src/anthropic/_utils/_transform.py:252
↓ 7 callersFunctionextract_type_arg
(typ: type, index: int)
src/anthropic/_utils/_typing.py:76
↓ 7 callersFunctionextract_type_var_from_base
Given a type like `Foo[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g. ```py
src/anthropic/_utils/_typing.py:84
↓ 7 callersMethodget_max_retries
(self, max_retries: int)
src/anthropic/_models.py:789
↓ 7 callersFunctionis_dict
(obj: object)
src/anthropic/_utils/_utils.py:160
↓ 7 callersFunctionis_list
(obj: object)
src/anthropic/_utils/_utils.py:164
↓ 7 callersFunctionis_mapping
(obj: object)
src/anthropic/_utils/_utils.py:152
↓ 7 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_legacy_response.py:97
↓ 7 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, remaining_retr
src/anthropic/_base_client.py:914
↓ 7 callersMethodresults
Streams the results of a Message Batch as a `.jsonl` file. Each line in the file is a JSON object containing the result of a single
src/anthropic/resources/messages/batches.py:266
↓ 6 callersMethod__class__
(self)
src/anthropic/_utils/_proxy.py:48
↓ 6 callersFunctionassert_different_identities
(obj1: object, obj2: object)
tests/test_deepcopy.py:4
↓ 6 callersFunctionbasic_response
()
tests/lib/streaming/test_messages.py:56
↓ 6 callersFunctiondeepcopy_minimal
Minimal reimplementation of copy.deepcopy() that will only copy certain object types: - mappings, e.g. `dict` - list This is done for pe
src/anthropic/_utils/_utils.py:172
↓ 6 callersFunctionextract_response_type
Given a type like `APIResponse[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g.
src/anthropic/_response.py:857
↓ 6 callersFunctionfoo
(a: str | None = None)
tests/test_required_args.py:10
↓ 6 callersMethodget_final_message
Waits until the stream has been read to completion and returns the accumulated `Message` object.
src/anthropic/lib/streaming/_messages.py:75
↓ 6 callersFunctionis_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:20
↓ 6 callersFunctionmodel_dump
( model: pydantic.BaseModel, *, exclude: IncEx | None = None, exclude_unset: bool = False,
src/anthropic/_compat.py:133
↓ 6 callersMethodmodel_dump_json
Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json Generates a JSON representation of the model using
src/anthropic/_models.py:322
↓ 5 callersMethod__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:54
↓ 5 callersFunctionasync_to_httpx_files
(files: None)
src/anthropic/_files.py:84
↓ 5 callersMethoditer_bytes
A byte-iterator over the decoded response content. This automatically handles gzip, deflate and brotli encoded responses.
src/anthropic/_response.py:384
↓ 5 callersFunctionmodel_copy
(model: _ModelT, *, deep: bool = False)
src/anthropic/_compat.py:121
↓ 5 callersMethodmodel_dump
Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump Generate a dictionary representation of the model, opti
src/anthropic/_models.py:265
↓ 5 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1497
↓ 5 callersFunctionset_pydantic_config
Add a pydantic config for the given type. Note: this is a no-op on Pydantic v1.
src/anthropic/_models.py:683
↓ 5 callersFunctionto_httpx_files
(files: None)
src/anthropic/_files.py:42
↓ 4 callersMethod__init__
(self, message: str, request: httpx.Request, *, body: object | None)
src/anthropic/_exceptions.py:40
↓ 4 callersMethod__init__
( self, *, url: URL, )
src/anthropic/_base_client.py:125
↓ 4 callersMethod_calculate_retry_timeout
( self, remaining_retries: int, options: FinalRequestOptions, response_headers
src/anthropic/_base_client.py:686
↓ 4 callersFunction_get_open_connections
(client: Anthropic | AsyncAnthropic)
tests/test_client.py:53
↓ 4 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/lib/streaming/_beta_messages.py:67
↓ 4 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/lib/streaming/_messages.py:67
↓ 4 callersFunctionconstruct_type_unchecked
Loose coercion to the expected type with construction of nested values. Note: the returned value from this function is not guaranteed to match th
src/anthropic/_models.py:431
↓ 4 callersMethodis_closed
Whether or not the response body has been closed. If this is False then there is response data that has not been read yet. You must e
src/anthropic/_response.py:114
↓ 4 callersFunctionis_type_alias_type
Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) # > True
src/anthropic/_utils/_typing.py:53
↓ 4 callersFunctioniter_next
(iter: Iterator[_T] | AsyncIterator[_T])
tests/decoders/test_jsonl.py:67
↓ 4 callersFunctionparse_obj
(model: type[_ModelT], value: object)
src/anthropic/_compat.py:79
↓ 4 callersMethodto_json
Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation). By default, fields th
src/anthropic/_models.py:153
↓ 4 callersFunctionupdate_env
(**new_env: str | Omit)
tests/utils.py:146
↓ 3 callersFunction_get_annotated_type
If the given type is an `Annotated` type then it is returned, if not `None` is returned. This also unwraps the type when applicable, e.g. `Requir
src/anthropic/_utils/_transform.py:111
↓ 3 callersMethod_get_page_items
(self)
src/anthropic/_base_client.py:177
↓ 3 callersMethod_request_api_list
( self, model: Type[object], page: Type[SyncPageT], options: FinalRequestOptio
src/anthropic/_base_client.py:1166
↓ 3 callersFunctionadd_request_id
(obj: BaseModel, request_id: str | None)
src/anthropic/_models.py:691
↓ 3 callersMethodaiter_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:333
↓ 3 callersFunctionbody
()
tests/decoders/test_jsonl.py:16
↓ 3 callersMethodclose
Close the underlying HTTPX client. The client will *not* be usable after this.
src/anthropic/_base_client.py:874
↓ 3 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:404
↓ 3 callersFunctionextract_files
Recursively extract files from the given dictionary based on specified paths. A path may look like this ['foo', 'files', '<array>', 'data'].
src/anthropic/_utils/_utils.py:38
↓ 3 callersFunctionis_file_content
(obj: object)
src/anthropic/_files.py:27
↓ 3 callersFunctionis_iterable
(obj: object)
src/anthropic/_utils/_utils.py:168
↓ 3 callersFunctionis_list_type
(typ: type)
src/anthropic/_utils/_typing.py:24
↓ 3 callersFunctionis_mapping_t
(obj: _MappingT | object)
src/anthropic/_utils/_utils.py:156
↓ 3 callersFunctionis_union_type
(typ: type)
src/anthropic/_utils/_typing.py:34
↓ 3 callersMethoditer_bytes
(self, chunk_size: int | None = None)
src/anthropic/_legacy_response.py:437
↓ 3 callersFunctionmake_jsonl_iterator
( content: Iterator[bytes], *, sync: bool, line_type: type[_T], )
tests/decoders/test_jsonl.py:78
↓ 3 callersMethodnext_page_info
(self)
src/anthropic/_base_client.py:175
↓ 3 callersFunctionparse_datetime
(value: Union[datetime, StrBytesIntFloat])
src/anthropic/_compat.py:28
↓ 3 callersMethodread
Read and return the binary response content.
src/anthropic/_response.py:464
↓ 3 callersFunctionstrip_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:69
↓ 3 callersFunctionto_async_iter
(iter: Iterator[_T])
tests/lib/streaming/test_messages.py:61
↓ 2 callersMethod__anext__
(self)
src/anthropic/_streaming.py:181
next →1–100 of 1,183, ranked by callers