MCPcopy Create free account

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

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

↓ 3 callersFunction_strip_traceback
Detach the frames chained onto ``err`` before raising from it. Foreign frames (json decoder, httpx transport) hold raw payloads — request bod
src/anthropic/lib/credentials/_secrets.py:104
↓ 3 callersFunction_transform_recursive
Transform the given data against the expected type. Args: annotation: The direct type annotation given to the particular piece of data.
src/anthropic/_utils/_transform.py:154
↓ 3 callersFunction_unwrap_secret
Inverse of :func:`_wrap_secret_fields` for a single value; pass-through for values that were never wrapped (absent or non-string fields).
src/anthropic/lib/credentials/_secrets.py:83
↓ 3 callersFunction_validate_profile_name
Reject profile names that could escape the config directory. Profile names come from user-controlled sources (``ANTHROPIC_PROFILE``, the ``ac
src/anthropic/lib/credentials/_constants.py:135
↓ 3 callersFunction_wrap_secret_fields
Wrap the secret fields of a parsed JSON object in ``SecretStr``. Called at every boundary where credential material enters SDK code. Tracebac
src/anthropic/lib/credentials/_secrets.py:51
↓ 3 callersFunctionadd_request_id
(obj: BaseModel, request_id: str | None)
src/anthropic/_models.py:844
↓ 3 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:111
↓ 3 callersMethodarm
(Re)start the idle countdown from now and wake the watchdog. Deferred while any gated call is held or in flight — stopping then would
src/anthropic/lib/tools/_beta_session_runner.py:185
↓ 3 callersFunctionasync_mcp_tool
Convert an MCP tool to an async runnable tool for ``tool_runner()``. Example:: from anthropic.lib.tools.mcp import async_mcp_tool
src/anthropic/lib/tools/mcp.py:391
↓ 3 callersFunctionbody
()
tests/decoders/test_jsonl.py:17
↓ 3 callersMethodcall
(self, input: object)
src/anthropic/lib/tools/_tool_dispatch.py:34
↓ 3 callersMethodclose
Close the underlying HTTPX client. The client will *not* be usable after this.
src/anthropic/_base_client.py:1043
↓ 3 callersFunctionconsume_async_iterator
(iterator: AsyncIterator[Any])
src/anthropic/_utils/_streams.py:10
↓ 3 callersFunctionconsume_sync_iterator
(iterator: Iterator[Any])
src/anthropic/_utils/_streams.py:5
↓ 3 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:184
↓ 3 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:348
↓ 3 callersMethodcreate
Create a new memory file with the specified content.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:139
↓ 3 callersFunctioncreate_stream_async
(client: AsyncAnthropic)
tests/lib/test_refusal_fallback_streaming.py:205
↓ 3 callersFunctionexchange_federation_assertion
Perform a single RFC 7523 ``jwt-bearer`` exchange and return the resulting :class:`AccessToken`. This is a one-shot convenience wrapper aroun
src/anthropic/lib/credentials/_workload.py:349
↓ 3 callersMethodget_max_retries
(self, max_retries: int)
src/anthropic/_models.py:961
↓ 3 callersFunctionhandler
(req: httpx.Request)
tests/lib/test_scoped_client.py:126
↓ 3 callersMethodhas_next_page
(self)
src/anthropic/pagination.py:36
↓ 3 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
↓ 3 callersFunctionis_file_content
(obj: object)
src/anthropic/_files.py:29
↓ 3 callersFunctionis_iterable
(obj: object)
src/anthropic/_utils/_utils.py:202
↓ 3 callersFunctionis_list_type
(typ: type)
src/anthropic/_utils/_typing.py:25
↓ 3 callersFunctionis_sequence_type
(typ: type)
src/anthropic/_utils/_typing.py:29
↓ 3 callersFunctionis_union_type
(typ: type)
src/anthropic/_utils/_typing.py:40
↓ 3 callersMethoditer_bytes
(self, chunk_size: int | None = None)
src/anthropic/_legacy_response.py:440
↓ 3 callersFunctionjson_response
(body: Any, status: int)
tests/lib/test_refusal_fallback_streaming.py:97
↓ 3 callersFunctionmake_async_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1808
↓ 3 callersFunctionmake_async_client
(**kwargs: Any)
tests/lib/test_refusal_fallback_streaming.py:77
↓ 3 callersFunctionmake_async_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1824
↓ 3 callersFunctionmake_bedrock_client
(**kwargs: Any)
tests/test_middleware.py:1804
↓ 3 callersFunctionmake_jsonl_iterator
( content: Iterator[bytes], *, sync: bool, line_type: type[_T], )
tests/decoders/test_jsonl.py:79
↓ 3 callersFunctionmake_mantle_client
(**kwargs: Any)
tests/test_middleware.py:1820
↓ 3 callersFunctionmake_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1812
↓ 3 callersFunctionmcp_resource_to_file
Convert MCP resource contents to a file tuple for ``files.upload()``. Returns a ``(filename, content_bytes, mime_type)`` tuple compatible with
src/anthropic/lib/tools/mcp.py:278
↓ 3 callersMethodnext_page_info
(self)
src/anthropic/_base_client.py:209
↓ 3 callersMethodread
Read and return the binary response content.
src/anthropic/_response.py:467
↓ 3 callersMethodrefresh
(self, _request: object)
tests/lib/test_google_cloud.py:58
↓ 3 callersMethodset_messages_params
Update the parameters for the next API call. This invalidates any cached tool responses. Args: params (ParsedMessageCrea
src/anthropic/lib/tools/_beta_runner.py:96
↓ 3 callersMethodstart
(cls, workdir: str | os.PathLike[str], *, env: Optional[Mapping[str, str]] = None)
src/anthropic/lib/tools/agent_toolset.py:316
↓ 3 callersFunctionstrip_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:76
↓ 3 callersFunctiontool_error_content
Render an exception raised by a tool as tool-result content. A :class:`ToolError` carries its own structured content; anything else is render
src/anthropic/lib/tools/_tool_dispatch.py:48
↓ 2 callersMethod__aenter__
(self)
src/anthropic/lib/tools/agent_toolset.py:247
↓ 2 callersMethod__aenter__
(self)
tests/lib/tools/test_session_runner.py:147
↓ 2 callersMethod__enter__
(self)
src/anthropic/_streaming.py:172
↓ 2 callersMethod__exit__
( self, exc_type: type[BaseException] | None, exc: BaseException | None, exc_t
src/anthropic/lib/streaming/_messages.py:73
↓ 2 callersMethod__init__
( self, *, raw: httpx.Response, cast_to: type[R], client: BaseClient[A
src/anthropic/_response.py:62
↓ 2 callersMethod__init__
( self, *, resource: str | None = None, api_key: str | None = None, az
src/anthropic/lib/foundry.py:97
↓ 2 callersMethod__init__
( self, *, params: ParseMessageCreateParamsBase[ResponseFormatT], options: Req
src/anthropic/lib/tools/_beta_runner.py:68
↓ 2 callersMethod__stream__
(self)
src/anthropic/_streaming.py:86
↓ 2 callersFunction_active_profile
Resolve the active profile name. ``ANTHROPIC_PROFILE`` env var → ``<config_dir>/active_config`` pointer file → ``"default"`` literal. The res
src/anthropic/lib/credentials/_constants.py:98
↓ 2 callersMethod_applicable_body
The request's JSON body when this middleware applies to it, `None` otherwise.
src/anthropic/lib/middleware/_fallbacks.py:309
↓ 2 callersMethod_apply
(self, request: httpx.Request, token: str)
src/anthropic/lib/credentials/_auth.py:88
↓ 2 callersFunction_archive_top_dir
Return the single top-level directory shared by every archive entry, or ``""`` if the entries don't all live under one common directory. Skil
src/anthropic/lib/tools/_skills.py:61
↓ 2 callersFunction_async_atomic_write_file
(target_path: AsyncPath, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:610
↓ 2 callersFunction_async_transform_recursive
Transform the given data against the expected type. Args: annotation: The direct type annotation given to the particular piece of data.
src/anthropic/_utils/_transform.py:322
↓ 2 callersMethod_atomic_write_credentials
Atomic write to the credentials file (NOT the config file). ``data`` may hold :class:`SecretStr` token values (see :meth:`_read_crede
src/anthropic/lib/credentials/_providers.py:429
↓ 2 callersFunction_atomic_write_file
(target_path: Path, content: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:281
↓ 2 callersMethod_attempt_request
Prepare, build and send a single HTTP attempt. Returns the response regardless of its status code, along with the prepared options it
src/anthropic/_base_client.py:1265
↓ 2 callersMethod_attempt_request
Prepare, build and send a single HTTP attempt. Returns the response regardless of its status code, along with the prepared options it
src/anthropic/_base_client.py:2017
↓ 2 callersFunction_bind_credentials_base_url
If the credential provider supports ``bind_base_url``, pass it the client's resolved ``base_url`` so the token exchange and API calls hit the
src/anthropic/_client.py:73
↓ 2 callersFunction_close_credentials
Release any resources owned by a credential provider, if it exposes ``close()``.
src/anthropic/_client.py:66
↓ 2 callersFunction_collect_error
(match: Match[str])
scripts/utils/ruffen-docs.py:39
↓ 2 callersFunction_config_file_path
Path to ``<config_dir>/configs/<profile>.json`` (non-secret, 0644).
src/anthropic/lib/credentials/_constants.py:179
↓ 2 callersMethod_convert_to_legacy_response
Convert an `APIResponse` / `AsyncAPIResponse` into the equivalent `LegacyAPIResponse`.
src/anthropic/_base_client.py:663
↓ 2 callersFunction_credit_token
The refusal's minted credit token; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1354
↓ 2 callersFunction_declined_iteration_entries
The `usage.iterations` entries a declined hop contributes to the chain. The hop's refusal self-reports its iterations: adopt them, retyped to
src/anthropic/lib/middleware/_fallbacks.py:1154
↓ 2 callersFunction_default_worker_id
()
src/anthropic/lib/environments/_poller.py:46
↓ 2 callersFunction_expects_response_wrapper
Whether the given `cast_to` asks for the `APIResponse` wrapper itself.
src/anthropic/_base_client.py:2648
↓ 2 callersMethod_fallback
(self, request: APIRequest)
tests/test_middleware.py:137
↓ 2 callersFunction_from_unix_seconds
(seconds: Union[int, float])
src/anthropic/_utils/_datetime_parse.py:44
↓ 2 callersMethod_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:262
↓ 2 callersMethod_get_azure_ad_token
(self)
src/anthropic/lib/foundry.py:487
↓ 2 callersMethod_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:382
↓ 2 callersMethod_get_last_assistant_message
(self)
src/anthropic/lib/tools/_beta_runner.py:614
↓ 2 callersFunction_get_numeric
(value: StrBytesIntFloat, native_expected_type: str)
src/anthropic/_utils/_datetime_parse.py:33
↓ 2 callersFunction_get_params
(client: BaseClient[Any, Any])
tests/test_client.py:46
↓ 2 callersMethod_get_token
(self)
src/anthropic/lib/google_cloud/_client.py:325
↓ 2 callersFunction_get_weather
(location: str, units: Literal["c", "f"])
tests/lib/tools/test_runners.py:772
↓ 2 callersMethod_handle_item
The per-item body shared by :meth:`run`'s poll loop and :meth:`handle_item`. Runs a :class:`SessionToolRunner` for the work item's session wh
src/anthropic/lib/environments/_worker.py:376
↓ 2 callersFunction_has_explicit_active_config
True if the user wrote a non-empty ``active_config`` pointer file. This is an explicit opt-in signal equivalent to setting ``ANTHROPIC_PROFILE``:
src/anthropic/lib/credentials/_constants.py:208
↓ 2 callersMethod_has_static_credential
(request: httpx.Request)
src/anthropic/lib/credentials/_auth.py:85
↓ 2 callersMethod_idempotency_key
(self)
src/anthropic/_base_client.py:902
↓ 2 callersFunction_infer_region
Infer the AWS region from the environment variables or from the boto3 session if available.
src/anthropic/lib/bedrock/_client.py:72
↓ 2 callersMethod_info_to_options
(self, info: PageInfo)
src/anthropic/_base_client.py:218
↓ 2 callersFunction_is_async_callable
Whether calling the given object returns a coroutine. Unlike `inspect.iscoroutinefunction(obj)` this also handles class instances that define
src/anthropic/_middleware.py:73
↓ 2 callersMethod_iter_events
(self)
src/anthropic/_streaming.py:74
↓ 2 callersFunction_make
(fn: FunctionT)
src/anthropic/lib/tools/_beta_functions.py:415
↓ 2 callersMethod_make_pin
Pin requests sharing the state to the entry being tried (or warn that there is none).
src/anthropic/lib/middleware/_fallbacks.py:351
↓ 2 callersMethod_make_sse_decoder
(self)
src/anthropic/_base_client.py:505
↓ 2 callersMethod_make_status_error_from_response
( self, response: httpx.Response, )
src/anthropic/_base_client.py:426
↓ 2 callersFunction_make_zip
(path: Path, entries: dict[str, bytes])
tests/lib/tools/test_skills.py:29
↓ 2 callersMethod_maybe_override_cast_to
(self, cast_to: type[ResponseT], options: FinalRequestOptions)
src/anthropic/_base_client.py:646
↓ 2 callersFunction_maybe_transform_key
Transform the given `data` based on the annotations provided in `type_`. Note: this function only looks at `Annotated` types that contain `Proper
src/anthropic/_utils/_transform.py:131
↓ 2 callersFunction_merged_body
The non-streaming retry body: the fallback entry merged whole over the original params, plus the refusal's credit token when it minted one.
src/anthropic/lib/middleware/_fallbacks.py:1430
↓ 2 callersFunction_middleware_entry_mode
The raw-response mode the original caller entered the middleware chain with.
src/anthropic/_base_client.py:2616
↓ 2 callersFunction_middleware_name
(middleware: object)
src/anthropic/_middleware.py:66
← previousnext →301–400 of 4,863, ranked by callers