MCPcopy Create free account

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

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

↓ 8 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1079
↓ 8 callersFunctionto_httpx_files
(files: None)
src/anthropic/_files.py:42
↓ 8 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:182
↓ 7 callersFunction_api_status_error
(code: int)
tests/lib/tools/test_session_runner.py:125
↓ 7 callersFunction_downloaded
A ``SessionMemoryStores`` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_keep_only_copy.py:21
↓ 7 callersMethod_ensure_memory_root
Ensure the memory root directory exists
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:678
↓ 7 callersMethod_make_client
(self)
tests/lib/test_bedrock_mantle.py:130
↓ 7 callersFunction_mcp_field_v1_or_v2
(obj: Any, name: str)
src/anthropic/lib/tools/mcp.py:78
↓ 7 callersFunction_mock_client
(result: CallToolResult | None = None)
tests/lib/tools/test_mcp_tool.py:67
↓ 7 callersFunction_read_result
(contents: list[Any])
tests/lib/tools/test_mcp_tool.py:51
↓ 7 callersFunction_text_resource
(uri: str = "file:///x.txt", text: str = "hello", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:43
↓ 7 callersFunction_tool_reference_block
(kind: Literal["tool_removal", "tool_addition"], name: str)
tests/lib/tools/test_runners.py:1018
↓ 7 callersFunction_tool_use_response
(tool_name: str, tool_use_id: str, input: Union[Dict[str, Any], None] = None)
tests/lib/tools/test_runners.py:979
↓ 7 callersMethod_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:396
↓ 7 callersFunctionbeta_agent_toolset_20260401
Return the ``agent_toolset_20260401`` implementations bound to ``ctx``. The result is a plain list of :class:`~anthropic.lib.tools.BetaAsyncFunct
src/anthropic/lib/tools/agent_toolset.py:930
↓ 7 callersFunctionbeta_glob_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:807
↓ 7 callersFunctionbeta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:104
↓ 7 callersFunctionblock_starts
(events: list[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:194
↓ 7 callersFunctioncreated
(path: str, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:73
↓ 7 callersMethoddispose
Remove the root iff ``open`` created it; pre-existing roots are kept.
src/anthropic/lib/tools/_file_store.py:122
↓ 7 callersMethodexec
(self, cmd: str, timeout: float = BASH_DEFAULT_TIMEOUT)
src/anthropic/lib/tools/agent_toolset.py:488
↓ 7 callersMethodextra_headers
Return headers derived from the config file (e.g. ``workspace_id``). Eagerly reads the config if not yet loaded. The returned dict is
src/anthropic/lib/credentials/_providers.py:287
↓ 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:91
↓ 7 callersMethodfinish
(self, reason: _LeaseEndReason)
src/anthropic/lib/environments/_worker.py:138
↓ 7 callersFunctionget_args
(tp: type[Any])
src/anthropic/_utils/_compat.py:15
↓ 7 callersMethodhandle_item
Service a single, already-claimed work item without the poll loop. Builds the per-session :class:`AgentToolContext` (workdir from this
src/anthropic/lib/environments/_worker.py:531
↓ 7 callersFunctionmarker_stamp
(local: Path)
tests/lib/tools/memory_sync/test_folder_trust.py:28
↓ 7 callersFunctionmodel_dump
( model: pydantic.BaseModel, *, exclude: IncEx | None = None, exclude_unset: bool = False,
src/anthropic/_compat.py:144
↓ 7 callersFunctionrequest_body
(call: MockRequestCall)
tests/test_middleware.py:78
↓ 7 callersFunctionupdate_env
(**new_env: str | Omit)
tests/utils.py:151
↓ 7 callersFunctionvalidate_credentials
Raise if only one of aws_access_key/aws_secret_key is provided.
src/anthropic/lib/aws/_credentials.py:7
↓ 6 callersMethod_build_workload_delegate
(self, auth: Dict[str, Any])
src/anthropic/lib/credentials/_providers.py:690
↓ 6 callersFunction_custom_tool_use
A CUSTOM (user-defined) tool call — the agent emits ``agent.custom_tool_use`` rather than ``agent.tool_use`` for these.
tests/lib/tools/test_session_runner.py:96
↓ 6 callersFunction_is_status
(err: Exception, code: int)
src/anthropic/lib/environments/_poller.py:44
↓ 6 callersFunction_mock_deployment
Mock one deployment: its token endpoint mints ``token`` and its messages endpoint accepts anything. Pair with :func:`_requests_to` to check th
tests/lib/test_credentials.py:1982
↓ 6 callersFunction_mock_token_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:1947
↓ 6 callersFunction_mode
(p: Path)
tests/lib/tools/test_skills.py:172
↓ 6 callersFunction_reject_httpx_object
`httpx` objects don't work with `httpx2`, and would otherwise fail deep inside a request.
src/anthropic/_base_client.py:135
↓ 6 callersFunction_requests_to
(respx_mock: MockRouter, base_url: str)
tests/lib/test_credentials.py:1991
↓ 6 callersFunction_set_ambient_first_party_credentials
(monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws.py:138
↓ 6 callersFunction_sha
(content: str | bytes)
tests/lib/tools/test_file_store.py:27
↓ 6 callersFunction_sha
(content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:23
↓ 6 callersFunction_status_error
(code: int)
tests/lib/tools/memory_sync/_fake_anthropic.py:27
↓ 6 callersFunction_symlink_fixture
Workdir with two symlink cycles, a link that escapes, and a link whose target spells its way through a cycle to the escaping link.
tests/lib/tools/test_agent_toolset.py:85
↓ 6 callersFunction_validate_output_config_conflict
( output_config: BetaOutputConfigParam | Omit, output_format: object, )
src/anthropic/resources/beta/messages/messages.py:3905
↓ 6 callersMethod_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:682
↓ 6 callersMethod_walk_sync_auth
(client: Anthropic)
tests/lib/test_credentials.py:3248
↓ 6 callersMethod_workload_provider
(self, handler: Callable[[httpx2.Request], httpx2.Response])
tests/lib/test_credentials.py:3591
↓ 6 callersMethodappend_messages
Add one or more messages to the conversation history. This invalidates the cached tool response, i.e. if tools were already called, then they
src/anthropic/lib/tools/_beta_runner.py:138
↓ 6 callersFunctionbeta_async_tool
(func: AsyncFunctionT)
src/anthropic/lib/tools/_beta_functions.py:478
↓ 6 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/_client.py:865
↓ 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:864
↓ 6 callersFunctionextract_type_arg
(typ: type, index: int)
src/anthropic/_utils/_typing.py:83
↓ 6 callersFunctionfoo
(a: str | None = None)
tests/test_required_args.py:10
↓ 6 callersMethodinvalidate
Clear the cached token so the next :meth:`get_token` re-invokes the provider. Also sets a one-shot ``force_refresh`` flag so on-disk provider
src/anthropic/lib/credentials/_cache.py:177
↓ 6 callersFunctionmcp_resource_to_content
Convert MCP resource contents to an Anthropic content block. Finds the first resource with a supported MIME type from the result's ``contents
src/anthropic/lib/tools/mcp.py:244
↓ 6 callersMethodparse
( self, *, max_tokens: int, messages: Iterable[MessageParam], model: M
src/anthropic/resources/messages/messages.py:1131
↓ 6 callersFunctionredeemed_token
The request-body form of a redeemed credit token — the object shape, best-effort mode.
tests/lib/test_refusal_fallback_streaming.py:148
↓ 6 callersMethodstop
Track a content_block_stop, shifting `event["index"]`.
src/anthropic/lib/middleware/_fallbacks.py:1293
↓ 6 callersMethodto_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:189
↓ 6 callersMethodwith_middleware
A new client with the given middleware appended after this client's middleware. Convenience for applying extra middleware to a single request
src/anthropic/_client.py:522
↓ 5 callersMethod__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:57
↓ 5 callersMethod__init__
( self, *, url: URL, )
src/anthropic/_base_client.py:156
↓ 5 callersFunction_api_status_error
(code: int)
tests/lib/environments/test_poller_method.py:38
↓ 5 callersFunction_api_status_error
(code: int, body: object = None)
tests/lib/environments/test_worker.py:58
↓ 5 callersFunction_chunk_bytes_to_sse
(raw: bytes)
src/anthropic/lib/bedrock/_stream_decoder.py:68
↓ 5 callersFunction_created_store
(root: Path, *, utf8_only: bool = False)
tests/lib/tools/test_file_store.py:31
↓ 5 callersFunction_downloaded
A ``SessionMemoryStores`` with one store already downloaded to disk.
tests/lib/tools/memory_sync/test_two_pass.py:24
↓ 5 callersFunction_drain_one
Pull a single item from a sync iterator; assert there was one.
tests/lib/environments/test_poller_method.py:120
↓ 5 callersFunction_emit
(event: str, payload: dict[str, Any])
src/anthropic/lib/middleware/_fallbacks.py:1556
↓ 5 callersFunction_encode_secret
Build a work-item ``secret`` the way the control plane does: URL-safe base64 of a JSON payload, without padding.
tests/lib/environments/test_worker.py:52
↓ 5 callersMethod_enforce_trailing_slash
(self, url: URL)
src/anthropic/_base_client.py:431
↓ 5 callersMethod_get_http_client
Return an ``httpx2.Client``, lazily creating (and tracking) one we own.
src/anthropic/lib/credentials/_providers.py:427
↓ 5 callersFunction_is_base_client
True only for the base ``Anthropic`` / ``AsyncAnthropic`` classes, not subclasses. Subclasses (``AnthropicAWS``, ``AnthropicFoundry``) have their
src/anthropic/_client.py:49
↓ 5 callersMethod_load_config
Read and cache the config file, resolving ``base_url`` and ``credentials_path``.
src/anthropic/lib/credentials/_providers.py:304
↓ 5 callersFunction_to_session_content
(content: Any)
tests/lib/tools/test_session_runner.py:1679
↓ 5 callersFunction_within
True if ``child`` is ``root`` or a path inside it (both already resolved).
src/anthropic/lib/tools/_skills.py:38
↓ 5 callersMethod_write_refresh_profile
(self, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:3670
↓ 5 callersFunctionaccumulate_event
( *, event: BetaRawMessageStreamEvent, current_snapshot: ParsedBetaMessage[ResponseFormatT] | None
src/anthropic/lib/streaming/_beta_messages.py:455
↓ 5 callersFunctionassert_different_identities
(obj1: object, obj2: object)
tests/test_files.py:96
↓ 5 callersFunctionbeta_grep_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:842
↓ 5 callersFunctionbuild
Construct a BaseModel class without validation. This is useful for cases where you need to instantiate a `BaseModel` from an API response as
src/anthropic/_models.py:551
↓ 5 callersMethodcopy
( self, *, method: str | NotGiven = not_given, url: str | NotGiven = not_given
src/anthropic/_request.py:69
↓ 5 callersMethodcreate_root
Create the root directory and any missing ancestors; already existing is fine.
src/anthropic/lib/tools/_file_store.py:115
↓ 5 callersMethoddispose
Remove every store directory that :meth:`download` created. Pre-existing directories are left alone — that is :meth:`FileStore.dispos
src/anthropic/lib/tools/_memories.py:524
↓ 5 callersFunctiondrive
()
tests/lib/tools/test_session_runner.py:572
↓ 5 callersMethodfor_base_url
Return the provider a client with ``base_url`` should exchange through. Binds in place, unless another client already bound this instance to
src/anthropic/lib/credentials/_providers.py:246
↓ 5 callersFunctionhop_refusal
A fallback hop that contributes one text block, then refuses with a fresh token.
tests/lib/test_refusal_fallback_streaming.py:679
↓ 5 callersFunctionis_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:21
↓ 5 callersFunctionis_fatal_status_error
True for a 4xx that retrying will not fix (bad key, missing resource). Aligns with the core client's ``_should_retry`` policy: 408 / 409 / 429 ar
src/anthropic/lib/_retry.py:42
↓ 5 callersFunctionis_mapping_t
(obj: _MappingT | object)
src/anthropic/_utils/_utils.py:190
↓ 5 callersMethoditer_bytes
A byte-iterator over the decoded response content. This automatically handles gzip, deflate and brotli encoded responses.
src/anthropic/_response.py:387
↓ 5 callersMethodlist
List Files Args: ids: Restrict the result set to Files whose `id` is in this list. At most 100 entries (afte
src/anthropic/resources/files.py:62
↓ 5 callersFunctionmake_lenient_client
A client with the default (non-strict) response validation. The fixture wire's terminal refusal delta self-reports a `{type: "message"}` iter
tests/lib/test_refusal_fallback_streaming.py:81
↓ 5 callersFunctionmcp_tool
Convert an MCP tool to a sync runnable tool for ``tool_runner()``. Example:: from anthropic.lib.tools.mcp import mcp_tool tools
src/anthropic/lib/tools/mcp.py:310
↓ 5 callersFunctionprint_obj
Pretty print an object to a string
tests/lib/utils.py:18
↓ 5 callersMethodprovider
(*, force_refresh: bool = False)
tests/lib/test_credentials.py:1647
↓ 5 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1775
↓ 5 callersFunctionserving_stream
(model: str = FALLBACK_MODEL, message_id: str = "msg_b")
tests/lib/test_refusal_fallback_streaming.py:933
↓ 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:862
← previousnext →201–300 of 6,500, ranked by callers