MCPcopy Create free account

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

Functions6,662 in github.com/anthropics/anthropic-sdk-python

↓ 1,524 callersFunctionassert_matches_type
( type_: Any, value: object, *, path: list[str], allow_none: bool = False, )
tests/utils.py:48
↓ 1,023 callersMethodget
(self, __key: str)
src/anthropic/_types.py:199
↓ 831 callersMethodparse
(self, query: str)
src/anthropic/_qs.py:32
↓ 439 callersFunctionmake_request_options
Create a dict of type RequestOptions without keys of NotGiven values.
src/anthropic/_base_client.py:2283
↓ 428 callersMethodcreate
(self, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:685
↓ 387 callersMethodlist
(self, _session_id: str, *, limit: int = 1000, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:212
↓ 386 callersMethodpost
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1452
↓ 360 callersFunctionis_given
(obj: _T | NotGiven | Omit)
src/anthropic/_utils/_utils.py:156
↓ 351 callersMethodretrieve
(self, version: str, *, skill_id: str)
tests/lib/tools/test_skills.py:392
↓ 349 callersFunctionstrip_not_given
(obj: None)
src/anthropic/_utils/_utils.py:306
↓ 295 callersFunctionpath_template
Interpolate {name} placeholders in `template` from keyword arguments. Args: template: The template string containing {name} placeholders.
src/anthropic/_utils/_path.py:78
↓ 204 callersMethodupdate
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:688
↓ 184 callersMethoddelete
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:691
↓ 162 callersFunctionmaybe_transform
Wrapper over `transform()` that allows `None` to be passed. See `transform()` for more details.
src/anthropic/_utils/_transform.py:75
↓ 148 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:241
↓ 127 callersMethodget
The file's bytes; `None` when absent.
src/anthropic/lib/tools/_file_store.py:151
↓ 83 callersMethodconstruct
( # pyright: ignore[reportIncompatibleMethodOverride] __cls: Type[ModelT], _fields_set: set[s
src/anthropic/_models.py:228
↓ 78 callersMethodstream
(self, _session_id: str, *, extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:202
↓ 71 callersFunctionrun_sync
Drive one reconcile pass without clock bookkeeping. The public cadence path (`sync_if_due` plus the clock) is exercised by the worker tests;
tests/lib/tools/memory_sync/conftest.py:33
↓ 69 callersMethod_build_request
( self, options: FinalRequestOptions, *, retries_taken: int = 0, )
src/anthropic/_base_client.py:509
↓ 69 callersFunction_write_profile
Test helper: lay out `configs/<profile>.json` and optionally `credentials/<profile>.json` under `config_dir`. Accepts either the new nested `
tests/lib/test_credentials.py:136
↓ 68 callersFunctionasync_maybe_transform
Wrapper over `async_transform()` that allows `None` to be passed. See `async_transform()` for more details.
src/anthropic/_utils/_transform.py:283
↓ 63 callersMethodcall
(self, input: dict[str, Any])
tests/lib/tools/test_session_runner.py:247
↓ 54 callersFunctionmessage_body
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:61
↓ 52 callersMethodadd
Add two numbers.
tests/lib/tools/test_functions.py:470
↓ 52 callersMethodremove
Delete a file or subtree; absent — and the banned store root — do nothing.
src/anthropic/lib/tools/_file_store.py:232
↓ 51 callersMethodget_final_message
Waits until the stream has been read to completion and returns the accumulated `Message` object.
src/anthropic/lib/streaming/_messages.py:94
↓ 50 callersFunctionasync_to_raw_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support returning the raw `APIResponse` object directly.
src/anthropic/_response.py:802
↓ 50 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:714
↓ 50 callersFunctionget_response
Convert a fixture file into a stream of bytes for testing.
tests/lib/streaming/helpers.py:18
↓ 50 callersFunctionto_raw_response_wrapper
Higher order function that takes one of our bound API methods and wraps it to support returning the raw `APIResponse` object directly.
src/anthropic/_response.py:785
↓ 50 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:695
↓ 48 callersMethodclose
(self)
tests/lib/test_credentials.py:3749
↓ 45 callersMethodjson
(self)
src/anthropic/_request.py:58
↓ 43 callersFunctionsse_response
(body: str)
tests/lib/test_refusal_fallback_streaming.py:93
↓ 42 callersFunction_run_with_fakes
( *, events: FakeAsyncEvents, tools: list[Any], max_idle: float | None = None, environment
tests/lib/tools/test_session_runner.py:280
↓ 42 callersFunctionmake_sync_client
(**kwargs: Any)
tests/test_middleware.py:53
↓ 42 callersMethodtool_runner
( self, *, max_tokens: int, messages: Iterable[BetaMessageParam], mode
src/anthropic/resources/beta/messages/messages.py:1356
↓ 40 callersFunction_terminated
()
tests/lib/tools/test_session_runner.py:106
↓ 39 callersFunction_tool_use
( id: str, name: str, input: dict[str, Any], *, evaluated_permission: str | None = None, )
tests/lib/tools/test_session_runner.py:75
↓ 39 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:497
↓ 37 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:290
↓ 36 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:450
↓ 35 callersFunctioncollect
(stream: Stream[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:153
↓ 35 callersFunctioncreate_stream
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit )
tests/lib/test_refusal_fallback_streaming.py:198
↓ 35 callersMethodget_token
Return a valid bearer token, refreshing if necessary.
src/anthropic/lib/credentials/_cache.py:179
↓ 34 callersFunctionmake_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:73
↓ 33 callersMethoddownload
Download File Args: file_id: ID of the File. extra_headers: Send extra headers extra_query: Add addi
src/anthropic/resources/files.py:157
↓ 33 callersFunctionmessage
(model: str, **overrides: Any)
tests/lib/test_refusal_fallback.py:40
↓ 32 callersFunctionbeta_read_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:668
↓ 32 callersMethoddecode
(self, line: str)
src/anthropic/_streaming.py:427
↓ 32 callersFunctionmake_sync_client
(**kwargs: Any)
tests/lib/test_refusal_fallback.py:32
↓ 30 callersFunctionmake_async_client
(**kwargs: Any)
tests/test_middleware.py:57
↓ 30 callersFunctionmerge_headers
Compose header layers into a single layer: a plain mapping, as `default_headers=` and `extra_headers=` accept, that still carries an `Omit` for ev
src/anthropic/_base_client.py:2524
↓ 30 callersFunctiontransform
( data: _T, expected_type: object, use_async: bool, )
tests/test_transform.py:27
↓ 29 callersFunctioncreate_message
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit, fallbacks: List[BetaFal
tests/lib/test_refusal_fallback.py:74
↓ 28 callersFunctionprovider
()
tests/lib/test_google_cloud.py:248
↓ 28 callersMethoduntil_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:123
↓ 27 callersFunction_end_turn_response
()
tests/lib/tools/test_runners.py:1010
↓ 27 callersFunctionrefusal
(model: str, fallback_credit_token: str | None = None)
tests/lib/test_refusal_fallback.py:57
↓ 26 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:585
↓ 25 callersMethodopen
Resolve `root`; creates nothing — only `create_root` makes the folder.
src/anthropic/lib/tools/_file_store.py:100
↓ 25 callersFunctionparse_datetime
(value: Union[datetime, StrBytesIntFloat])
src/anthropic/_utils/_compat.py:44
↓ 25 callersMethodroot
(self)
src/anthropic/lib/tools/_file_store.py:119
↓ 25 callersFunctionto_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 25 callersMethodto_dict
(self)
tests/lib/test_stainless_helpers.py:24
↓ 24 callersMethodcompact_before_next_turn
Compact the conversation before the model's next turn. This only schedules the compaction. Once the current turn has finished, including
src/anthropic/lib/tools/_beta_runner.py:172
↓ 24 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:1243
↓ 24 callersMethodput
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1532
↓ 24 callersMethodsleep
(self, _seconds: float)
tests/lib/environments/test_poller_method.py:336
↓ 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
↓ 22 callersFunctiondefault_credentials
Resolve a `CredentialResult` from the environment per the credential-resolution spec. First match wins. Implements steps 2-5 of the spec prec
src/anthropic/lib/credentials/_chain.py:76
↓ 22 callersFunctionmake_client
(client_cls: ClientClass, **kwargs: Any)
tests/test_header_case_sensitivity.py:29
↓ 21 callersFunctionbuild
(client: Anthropic | AsyncAnthropic, **options: Any)
tests/test_header_case_sensitivity.py:34
↓ 21 callersMethodupload
Upload File Args: file: The file to upload. Only the final path component of the part's `filename` is kept;
src/anthropic/resources/files.py:232
↓ 20 callersFunction_fake_client
(work: _FakeWorkResource, sessions: _FakeSessions)
tests/lib/environments/test_worker.py:146
↓ 20 callersFunction_tool_use_response
(tool_name: str, tool_use_id: str, input: Union[Dict[str, Any], None] = None)
tests/lib/tools/test_runners.py:987
↓ 20 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:133
↓ 20 callersFunctionget_directory_snapshot
Get a snapshot of directory contents with relative paths.
tests/lib/tools/memory_tools/test_filesystem.py:42
↓ 20 callersMethodretrieve_metadata
Get File Metadata Args: file_id: ID of the File. extra_headers: Send extra headers extra_query: Add
src/anthropic/resources/files.py:195
↓ 19 callersFunction_assert_not_in_sdk_frame_locals
(exc: BaseException, *secrets: str)
tests/lib/test_credentials.py:4358
↓ 19 callersFunction_mock_messages_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:2212
↓ 19 callersFunction_send_message
(client: Anthropic)
tests/lib/test_credentials.py:2253
↓ 19 callersMethoddownload
Download every attached store's memories to disk. `session` arrives already fetched — one snapshot shared with the skills download.
src/anthropic/lib/tools/_memories.py:275
↓ 19 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
↓ 19 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:300
↓ 18 callersFunction_install_scoped_client
Intercept the shared bearer-auth client factory. Returns the list of args the factory was called with so a test can assert on the helper-tele
tests/lib/environments/test_worker.py:152
↓ 18 callersFunction_sent_request_bodies
(respx_mock: MockRouter)
tests/lib/tools/test_runners.py:1487
↓ 18 callersMethodcreate
Create 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:51
↓ 18 callersFunctionfake_anthropic
An `AsyncAnthropic`-shaped client with one memory store named `notes`. The store lands at `{workdir}/memory/notes`. Returns the client to han
tests/lib/tools/memory_sync/_fake_anthropic.py:187
↓ 18 callersMethodinvalidate
Clear the cached token so the next `get_token` re-invokes the provider. Also sets a one-shot `force_refresh` flag so on-disk providers skip
src/anthropic/lib/credentials/_cache.py:324
↓ 18 callersFunctioniter_work
Iterate work items claimed from a self-hosted environment. Each yielded `BetaSelfHostedWork` has already been ack'd. The `work` resource must
src/anthropic/lib/environments/_poller.py:83
↓ 18 callersFunctionmcp_content
Convert a single MCP content block to an Anthropic content block. Handles text, image, and embedded resource content types. Raises `Unsupport
src/anthropic/lib/tools/mcp.py:119
↓ 18 callersMethodread
Read and return the binary response content.
src/anthropic/_response.py:361
↓ 18 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:99
↓ 18 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:161
↓ 18 callersMethodstart
(self)
examples/memory/basic.py:50
↓ 18 callersFunctionupdated
(path: str, content: str, *, was: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:77
↓ 18 callersMethodwrite
(self, path: str, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:61
↓ 17 callersFunction_send_message_async
(client: AsyncAnthropic)
tests/lib/test_credentials.py:3129
next →1–100 of 6,662, ranked by callers