MCPcopy Create free account

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

Functions4,857 in github.com/anthropics/anthropic-sdk-python

↓ 998 callersFunctionassert_matches_type
( type_: Any, value: object, *, path: list[str], allow_none: bool = False, )
tests/utils.py:49
↓ 810 callersMethodget
(self, __key: str)
src/anthropic/_types.py:203
↓ 555 callersMethodparse
(self, query: str)
src/anthropic/_qs.py:32
↓ 398 callersMethodcreate
Create a Dream Args: model: Model identifier and configuration applied to every pipeline stage. betas: Optional
src/anthropic/resources/beta/dreams.py:48
↓ 307 callersFunctionis_given
(obj: _T | NotGiven | Omit)
src/anthropic/_utils/_utils.py:156
↓ 290 callersMethodpost
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1470
↓ 284 callersFunctionmake_request_options
Create a dict of type RequestOptions without keys of NotGiven values.
src/anthropic/_base_client.py:2370
↓ 261 callersFunctionstrip_not_given
(obj: None)
src/anthropic/_utils/_utils.py:306
↓ 238 callersMethodlist
(self, _session_id: str, *, limit: int = 1000, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:208
↓ 229 callersMethodretrieve
(self, session_id: str, *, betas: Any = None)
tests/lib/environments/test_worker.py:79
↓ 197 callersFunctionpath_template
Interpolate {name} placeholders in `template` from keyword arguments. Args: template: The template string containing {name} placeholders.
src/anthropic/_utils/_path.py:78
↓ 128 callersMethoddelete
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1590
↓ 122 callersMethodupdate
Update Vault Args: display_name: Updated human-readable name for the vault. 1-255 characters. metadata: Metadat
src/anthropic/resources/beta/vaults/vaults.py:164
↓ 110 callersMethodarchive
Archive a Dream Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers: Sen
src/anthropic/resources/beta/dreams.py:232
↓ 105 callersFunctionmaybe_transform
Wrapper over `transform()` that allows `None` to be passed. See `transform()` for more details.
src/anthropic/_utils/_transform.py:78
↓ 82 callersMethodconstruct
( # pyright: ignore[reportIncompatibleMethodOverride] __cls: Type[ModelT], _fields_set: set[s
src/anthropic/_models.py:221
↓ 64 callersFunction_write_profile
Test helper: lay out ``configs/<profile>.json`` and optionally ``credentials/<profile>.json`` under ``config_dir``. Accepts either the new ne
tests/lib/test_credentials.py:122
↓ 54 callersFunctionmessage_body
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:62
↓ 52 callersMethod_build_request
( self, options: FinalRequestOptions, *, retries_taken: int = 0, )
src/anthropic/_base_client.py:508
↓ 51 callersMethodstream
(self, _session_id: str, *, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:198
↓ 48 callersMethodclose
(self)
tests/lib/test_credentials.py:2677
↓ 45 callersFunctionasync_maybe_transform
Wrapper over `async_transform()` that allows `None` to be passed. See `async_transform()` for more details.
src/anthropic/_utils/_transform.py:286
↓ 42 callersFunctionmake_sync_client
(**kwargs: Any)
tests/test_middleware.py:54
↓ 39 callersFunction_run_with_fakes
( *, events: FakeAsyncEvents, tools: list[Any], max_idle: float | None = None, environment
tests/lib/tools/test_session_runner.py:259
↓ 38 callersFunctionsse_response
(body: str)
tests/lib/test_refusal_fallback_streaming.py:93
↓ 37 callersFunction_tool_use
( id: str, name: str, input: dict[str, Any], *, evaluated_permission: str | None = None, )
tests/lib/tools/test_session_runner.py:71
↓ 36 callersFunction_terminated
()
tests/lib/tools/test_session_runner.py:102
↓ 35 callersMethodjson
(self)
src/anthropic/_request.py:58
↓ 33 callersMethodcancel
Cancel a Dream Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers: Send
src/anthropic/resources/beta/dreams.py:279
↓ 32 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:709
↓ 32 callersMethodcall
(self, input: dict[str, Any])
tests/lib/tools/test_session_runner.py:243
↓ 32 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:690
↓ 31 callersFunctioncollect
(stream: Stream[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:148
↓ 31 callersFunctioncreate_stream
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit )
tests/lib/test_refusal_fallback_streaming.py:193
↓ 30 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:424
↓ 30 callersFunctionmake_async_client
(**kwargs: Any)
tests/test_middleware.py:58
↓ 30 callersFunctionmake_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:73
↓ 30 callersFunctiontransform
( data: _T, expected_type: object, use_async: bool, )
tests/test_transform.py:27
↓ 29 callersMethodget_final_message
Waits until the stream has been read to completion and returns the accumulated `Message` object.
src/anthropic/lib/streaming/_messages.py:89
↓ 27 callersFunctionmerge_headers
Merge header mappings, with later mappings taking precedence on a key clash, exactly like `_merge_mappings`. The exception is the headers in
src/anthropic/_base_client.py:2581
↓ 26 callersMethoddecode
(self, line: str)
src/anthropic/_streaming.py:471
↓ 26 callersFunctionprovider
()
tests/lib/test_google_cloud.py:250
↓ 26 callersMethodrun
Run Deployment Now Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers:
src/anthropic/resources/beta/deployments.py:472
↓ 25 callersFunctionget_response
Convert a fixture file into a stream of bytes for testing.
tests/lib/streaming/helpers.py:18
↓ 24 callersMethoddownload
Download File Args: file_id: ID of the File. betas: Optional header to specify the beta version(s) you want to
src/anthropic/resources/beta/files.py:187
↓ 24 callersFunctionmessage
(model: str, **overrides: Any)
tests/lib/test_refusal_fallback.py:40
↓ 24 callersMethodread
Read and return the binary response content.
src/anthropic/_response.py:360
↓ 24 callersFunctiontransform_schema
Transforms a JSON schema to ensure it conforms to the API's expectations. Args: json_schema (Dict[str, Any]): The original JSON sche
src/anthropic/lib/_parse/_transform.py:54
↓ 23 callersFunctionmake_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback.py:32
↓ 22 callersFunctiondefault_credentials
Resolve a :class:`CredentialResult` from the environment per the credential-resolution spec. First match wins. Implements steps 2-5 of the sp
src/anthropic/lib/credentials/_chain.py:76
↓ 22 callersMethodget_token
Return a valid bearer token, refreshing if necessary.
src/anthropic/lib/credentials/_cache.py:105
↓ 21 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:578
↓ 21 callersFunctionis_dict
(obj: object)
src/anthropic/_utils/_utils.py:194
↓ 21 callersFunctionparse_datetime
(value: Union[datetime, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:44
↓ 20 callersFunctioncreate_message
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit, fallbacks: List[BetaFal
tests/lib/test_refusal_fallback.py:74
↓ 20 callersFunctionget_directory_snapshot
Get a snapshot of directory contents with relative paths.
tests/lib/tools/memory_tools/test_filesystem.py:42
↓ 20 callersMethodtool_runner
( self, *, max_tokens: int, messages: Iterable[BetaMessageParam], mode
src/anthropic/resources/beta/messages/messages.py:1429
↓ 19 callersFunction_assert_not_in_sdk_frame_locals
(exc: BaseException, *secrets: str)
tests/lib/test_credentials.py:3233
↓ 19 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:1320
↓ 19 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:139
↓ 18 callersFunctionmcp_content
Convert a single MCP content block to an Anthropic content block. Handles text, image, and embedded resource content types. Raises :class:`Un
src/anthropic/lib/tools/mcp.py:113
↓ 18 callersFunctionrefusal
(model: str, fallback_credit_token: str | None = None)
tests/lib/test_refusal_fallback.py:57
↓ 18 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:156
↓ 17 callersMethodaclose
(self)
src/anthropic/_legacy_response.py:513
↓ 17 callersFunctionresolve_auth_mode
Determine whether to use SigV4 auth. Returns True for SigV4, False for API key. Auth precedence: 1. api_key constructor arg → API key mode
src/anthropic/lib/aws/_credentials.py:31
↓ 16 callersFunctioniter_work
Iterate work items claimed from a self-hosted environment. Each yielded :class:`BetaSelfHostedWork` has already been ack'd. The ``work`` reso
src/anthropic/lib/environments/_poller.py:53
↓ 15 callersFunctionbeta_tool
(func: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:343
↓ 15 callersMethodget
( self, path: str, *, cast_to: Type[ResponseT], options: RequestOption
src/anthropic/_base_client.py:1424
↓ 15 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:293
↓ 15 callersMethodwrite
(profile: str, *, with_base_url: Optional[str])
tests/lib/test_credentials.py:360
↓ 14 callersFunction_mock_messages_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:1862
↓ 14 callersFunction_tool_confirmation
The user's allow/deny verdict for an ask-gated (``always_ask``) tool call.
tests/lib/tools/test_session_runner.py:87
↓ 14 callersMethodadd
Add two numbers.
tests/lib/tools/test_functions.py:473
↓ 14 callersFunctiondeepcopy_with_paths
Copy only the containers along the given paths. Used to guard against mutation by extract_files without copying the entire structure. Only di
src/anthropic/_files.py:128
↓ 14 callersMethodstart
(self)
examples/memory/basic.py:50
↓ 14 callersMethodstream
Create a Message stream
src/anthropic/resources/messages/messages.py:1085
↓ 13 callersFunctionTypeAdapter
(*_args: Any, **_kwargs: Any)
src/anthropic/_models.py:904
↓ 13 callersFunction_copy_client_with_bearer_auth
Return a copy of ``client`` authenticated with ``auth_token`` as Bearer. The returned sub-client inherits the parent's full configuration via
src/anthropic/lib/_scoped_client.py:30
↓ 13 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:37
↓ 13 callersMethodinsert
Insert text at a specific line number in a memory file.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:149
↓ 13 callersMethodsend
Send Events Args: events: Events to send to the `session`. betas: Optional header to specify the beta version(s
src/anthropic/resources/beta/sessions/events.py:150
↓ 13 callersFunctionto_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 13 callersMethodview
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:134
↓ 12 callersMethod__class__
(self)
src/anthropic/_utils/_proxy.py:48
↓ 12 callersFunction_send_message
(client: Anthropic)
tests/lib/test_credentials.py:1880
↓ 12 callersFunctionerror_logs
Messages the middleware logged at ERROR — refusals surfaced rather than retried.
tests/lib/test_refusal_fallback_streaming.py:37
↓ 12 callersFunctionev
Serialize one event payload as an SSE frame (its `type` is the event name).
tests/lib/test_refusal_fallback_streaming.py:105
↓ 12 callersFunctioniter_next
(iter: Iterator[_T] | AsyncIterator[_T])
tests/test_streaming.py:254
↓ 12 callersFunctionresolve_api_key
Resolve the API key. Returns None if using SigV4.
src/anthropic/lib/aws/_credentials.py:65
↓ 12 callersMethodstop
(self, work_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:66
↓ 11 callersFunction_as_dict
(value: object)
src/anthropic/lib/middleware/_fallbacks.py:1450
↓ 11 callersFunctionbody
()
tests/test_streaming.py:18
↓ 11 callersFunctionget_auth_headers
( *, method: str, url: str, headers: httpx.Headers, aws_access_key: str | None, aws_se
src/anthropic/lib/aws/_auth.py:33
↓ 11 callersMethodrename
Rename or move a memory file or directory.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:159
↓ 11 callersFunctionresolve_base_url
Resolve the base URL from constructor arg, env var, or region. Returns None if no base URL is resolvable (caller should raise).
src/anthropic/lib/aws/_credentials.py:108
↓ 11 callersFunctionresolve_region
Resolve the AWS region from constructor arg or env var. Does not silently default — returns None if no region is available.
src/anthropic/lib/aws/_credentials.py:82
↓ 11 callersMethodsend
(self, session_id: str, *, events: list[Any], extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:221
↓ 10 callersFunction_validate_output_config_conflict
( output_config: BetaOutputConfigParam | Omit, output_format: object, )
src/anthropic/resources/beta/messages/messages.py:4194
↓ 10 callersFunction_warn_output_format_deprecated
Emit deprecation warning if output_format is provided.
src/anthropic/resources/beta/messages/messages.py:4218
↓ 10 callersMethodack
(self, work_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:63
next →1–100 of 4,857, ranked by callers