MCPcopy Create free account

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

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

↓ 2 callersMethod_mutate
(self, request: APIRequest)
tests/test_middleware.py:119
↓ 2 callersFunction_no_transform_needed
(annotation: type)
src/anthropic/_utils/_transform.py:150
↓ 2 callersMethod_open
Open the wire for this hop: its message_start (raw for stream A; suppressed or id-rewritten for a spliced hop), the queued seam frames,
src/anthropic/lib/middleware/_fallbacks.py:933
↓ 2 callersMethod_parse
(self, *, to: type[_T] | None = None)
src/anthropic/_response.py:129
↓ 2 callersMethod_parse_message_from_event
(self, event: EventStreamMessage)
src/anthropic/lib/bedrock/_stream_decoder.py:55
↓ 2 callersFunction_passthrough_sse
Forward a decoded event in its original wire bytes, preserving SSE fields beyond `event:`/`data:` (`id:`, `retry:`, comment lines). Falls back to
src/anthropic/lib/middleware/_fallbacks.py:1472
↓ 2 callersFunction_prepare_middleware_options
Build the options the base middleware handler hands to `_attempt_request()`. Returns a copy so that mutations made by the request pipeline never
src/anthropic/_base_client.py:2626
↓ 2 callersFunction_prepare_options
(input_options: FinalRequestOptions)
src/anthropic/lib/bedrock/_client.py:40
↓ 2 callersFunction_prepare_options
(input_options: FinalRequestOptions, *, project_id: str | None, region: str)
src/anthropic/lib/vertex/_client.py:420
↓ 2 callersMethod_prepare_options
(self, options: FinalRequestOptions)
src/anthropic/lib/foundry.py:275
↓ 2 callersMethod_prepare_options
(self, options: FinalRequestOptions)
src/anthropic/lib/foundry.py:502
↓ 2 callersMethod_prepare_request
(self, request: httpx.Request)
src/anthropic/lib/bedrock/_mantle.py:263
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:1337
↓ 2 callersMethod_process_response
( self, *, cast_to: Type[ResponseT], options: FinalRequestOptions, res
src/anthropic/_base_client.py:2089
↓ 2 callersMethod_process_response_data
( self, *, data: object, cast_to: type[ResponseT], response: httpx.Res
src/anthropic/_base_client.py:678
↓ 2 callersFunction_project_from_credentials
Best-effort project from an explicit credentials object — service-account / impersonated credentials usually know theirs.
src/anthropic/lib/google_cloud/_client.py:176
↓ 2 callersFunction_raise_token_endpoint_error
Raise a redacted :class:`WorkloadIdentityError` from a non-200 token-endpoint response. Shared between the jwt-bearer exchange path in this modul
src/anthropic/lib/credentials/_workload.py:75
↓ 2 callersFunction_read_active_config_pointer
Return the stripped contents of ``<config_dir>/active_config``, or ``None`` if the pointer file is missing or empty.
src/anthropic/lib/credentials/_constants.py:88
↓ 2 callersMethod_read_credentials
Read the credentials file. Re-reads on every call — daemons rotate it. Secret values in the returned dict (every string field not in
src/anthropic/lib/credentials/_providers.py:329
↓ 2 callersFunction_refusal_category
The policy category that caused the refusal; only the beta surface carries one.
src/anthropic/lib/middleware/_fallbacks.py:1361
↓ 2 callersFunction_refusal_with_tool_use
()
tests/lib/tools/test_runners.py:675
↓ 2 callersFunction_reject_skip_auth_conflict
( *, skip_auth: bool, token_provider: object | None, credentials: object | None, )
src/anthropic/lib/google_cloud/_client.py:163
↓ 2 callersFunction_request
(*, extra: str = "vertex")
src/anthropic/lib/_extras/_google_auth.py:38
↓ 2 callersFunction_require_env
(name: str)
examples/managed-agents-observe-tool-calls.py:45
↓ 2 callersFunction_resolve_base_url
base_url (arg or ``ANTHROPIC_GOOGLE_CLOUD_BASE_URL``, resolved by the caller) > derived template. Returns ``None`` when derivation must wait
src/anthropic/lib/google_cloud/_client.py:133
↓ 2 callersMethod_resolve_deferred_base_url
Derive and set the real base URL once the project is known. Called on every request (after the project back-fill from ADC, if any); a
src/anthropic/lib/google_cloud/_client.py:111
↓ 2 callersMethod_resolve_denied
Resolve a denied call without executing it. The denial itself resolves the call server-side — no result event will ever be posted for
src/anthropic/lib/tools/_beta_session_runner.py:756
↓ 2 callersFunction_resolve_mantle_config
Resolve and validate all Mantle client configuration. Returns (resolved_api_key, resolved_base_url, use_sigv4, merged_headers).
src/anthropic/lib/bedrock/_mantle.py:106
↓ 2 callersFunction_resolve_max_bytes
Resolve a configured cap to an effective size limit. ``not_given`` selects ``DEFAULT_MAX_FILE_BYTES``; ``None`` disables the size check (unca
src/anthropic/lib/tools/agent_toolset.py:96
↓ 2 callersFunction_resolve_under
Assert ``candidate`` resolves to a descendant of ``base``, return it verbatim. The containment check uses ``resolve(strict=False)`` on both sides
src/anthropic/lib/credentials/_constants.py:161
↓ 2 callersFunction_resource_contents_to_block
Convert MCP resource contents to an Anthropic content block.
src/anthropic/lib/tools/mcp.py:156
↓ 2 callersFunction_result_content
The content blocks the runner computed and posted back, as carried in ``result`` (the flat ``content`` convenience field was removed).
tests/lib/tools/test_session_runner.py:110
↓ 2 callersMethod_route_tool_event
Enqueue ``ev`` for dispatch, honoring its evaluated permission. A builtin call the server gated behind user confirmation (``evaluated
src/anthropic/lib/tools/_beta_session_runner.py:678
↓ 2 callersMethod_run
Drive the session tool loop, yielding an iterator of :class:`DispatchedToolCall`. :meth:`__aiter__` (and the module-level :func:`_run_
src/anthropic/lib/tools/_beta_session_runner.py:464
↓ 2 callersFunction_seamed_http_response
A copy of the served hop's response with `seams` prepended to its `content`, or `None` when the body isn't the expected message shape. The ca
src/anthropic/lib/middleware/_fallbacks.py:1378
↓ 2 callersFunction_serialize_sse
Serialize an event back to its SSE wire form (`event: ...\\ndata: ...\\n\\n`). Multi-line `data` is emitted as one `data:` line per line, matchin
src/anthropic/lib/middleware/_fallbacks.py:1482
↓ 2 callersMethod_set_private_attributes
( self, client: SyncAPIClient, model: Type[_T], options: FinalRequestOptions,
src/anthropic/_base_client.py:252
↓ 2 callersMethod_should_retry_exception
Whether an exception raised by a request attempt should be retried. Also returns the HTTP response behind the failure, when there is one, so
src/anthropic/_base_client.py:877
↓ 2 callersMethod_should_stop
(self)
src/anthropic/lib/tools/_beta_runner.py:125
↓ 2 callersMethod_should_stream_response_body
(self, request: httpx.Request)
src/anthropic/_base_client.py:675
↓ 2 callersMethod_shrink
(self, request: APIRequest)
tests/test_middleware.py:161
↓ 2 callersFunction_spliced_http_response
A synthetic response standing in for `original`, with `stream` as its body. The spliced frames are emitted post-decode, so the original's con
src/anthropic/lib/middleware/_fallbacks.py:1521
↓ 2 callersMethod_start_index
The chain entry this request starts at (-1 = the original params). Only an explicit `BetaFallbackState` pin moves the start; without one
src/anthropic/lib/middleware/_fallbacks.py:335
↓ 2 callersFunction_strip_omit
Drop entries whose value is an `Omit` removal marker.
src/anthropic/_base_client.py:2542
↓ 2 callersFunction_strip_seam_blocks
A copy of `body` with `{type: "fallback"}` seam blocks filtered out of the replayed message history; `body` itself when there are none. An as
src/anthropic/lib/middleware/_fallbacks.py:1307
↓ 2 callersFunction_strip_top
Drop the leading ``top`` component from ``safe`` (an already-confined relative path). Returns ``""`` for the bare top-dir entry itself.
src/anthropic/lib/tools/_skills.py:82
↓ 2 callersMethod_surface_call
Yield ``call`` to the consumer, tolerating a consumer that left early. ``BrokenResourceError`` — the consumer broke out of the iterator;
src/anthropic/lib/tools/_beta_session_runner.py:778
↓ 2 callersFunction_to_iteration_usage
( type: Literal["message", "fallback_message"], model: str, usage: dict[str, Any] | None )
src/anthropic/lib/middleware/_fallbacks.py:1496
↓ 2 callersFunction_to_prefill_blocks
Convert a hop's accumulated response blocks to the appended assistant turn. A `fallback_has_prefill_claim` refusal guarantees the partial output
src/anthropic/lib/middleware/_fallbacks.py:1274
↓ 2 callersFunction_user_agent
``User-Agent`` value sent on token-endpoint POSTs. Computed lazily so this module doesn't need to import ``_version`` at module load time (th
src/anthropic/lib/credentials/_constants.py:56
↓ 2 callersFunction_warn_env_shadow
Warn when an ``ANTHROPIC_API_KEY`` / ``ANTHROPIC_AUTH_TOKEN`` from the environment is set alongside signals that would normally drive profile /
src/anthropic/_client.py:99
↓ 2 callersFunction_warn_explicit_shadow
Warn when an explicit ``api_key=`` / ``auth_token=`` argument shadows an explicit ``credentials=`` provider. Call *after* any copy-inheritance
src/anthropic/_client.py:87
↓ 2 callersFunction_warn_once
Emit a log warning at most once per ``key`` per process.
src/anthropic/lib/credentials/_auth.py:22
↓ 2 callersFunction_with_middleware_headers
A copy of `request` with `betas` appended to its `anthropic-beta` header (skipping values already present) and the middleware's helper-telemetry t
src/anthropic/lib/middleware/_fallbacks.py:1338
↓ 2 callersMethodabsorb_refusal
Fold a refused hop's outcome in, readying the next hop.
src/anthropic/lib/middleware/_fallbacks.py:1112
↓ 2 callersFunctionaccumulate_event
( *, event: RawMessageStreamEvent, current_snapshot: ParsedMessage[ResponseFormatT] | None, ou
src/anthropic/lib/streaming/_messages.py:433
↓ 2 callersMethodack
Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating se
src/anthropic/resources/beta/environments/work.py:252
↓ 2 callersFunctionaclose_runnable_tool
Run a runnable tool's optional cleanup. Drives the legacy ``aclose`` / ``close`` attribute (awaited if it returns an awaitable) and, when the
src/anthropic/lib/tools/_beta_functions.py:311
↓ 2 callersMethodaiter_bytes
(self, chunk_size: int | None = None)
src/anthropic/_legacy_response.py:487
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:29
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:204
↓ 2 callersFunctionassert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:219
↓ 2 callersFunctionassert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:249
↓ 2 callersFunctionassert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:108
↓ 2 callersFunctionassert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:229
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:56
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:209
↓ 2 callersFunctionasync_to_custom_raw_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support returning the given respo
src/anthropic/_response.py:837
↓ 2 callersFunctionasync_to_custom_streamed_response_wrapper
Higher order function that takes one of our bound API methods and an `APIResponse` class and wraps the method to support streaming and returning t
src/anthropic/_response.py:755
↓ 2 callersMethodbegin
The chain state after stream A's chainable refusal.
src/anthropic/lib/middleware/_fallbacks.py:1037
↓ 2 callersFunctionbeta_write_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:530
↓ 2 callersMethodbind_base_url
Adopt the owning client's ``base_url`` as a fallback for the token exchange. Slots between the config file's own ``base_url`` field and
src/anthropic/lib/credentials/_providers.py:228
↓ 2 callersFunctionbuild_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:336
↓ 2 callersFunctionbuild_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:331
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:380
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_streaming.py:183
↓ 2 callersMethodclose
Close the owned ``httpx.Client`` if we created one.
src/anthropic/lib/credentials/_providers.py:409
↓ 2 callersMethodclose
Close the underlying ``httpx.Client`` if we created it.
src/anthropic/lib/credentials/_workload.py:215
↓ 2 callersFunctioncoerce_boolean
(val: str)
src/anthropic/_utils/_utils.py:336
↓ 2 callersMethodcontent_blocks
The accumulated content blocks, in start order.
src/anthropic/lib/middleware/_fallbacks.py:1205
↓ 2 callersMethodcontinuation
(self)
src/anthropic/lib/middleware/_fallbacks.py:1090
↓ 2 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/foundry.py:208
↓ 2 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/bedrock/_mantle.py:479
↓ 2 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/bedrock/_client.py:241
↓ 2 callersMethodcopy
( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] — narrows `credentials` to No
src/anthropic/lib/aws/_client.py:376
↓ 2 callersMethoddisarm
Cancel the idle countdown; only signals on an actual transition.
src/anthropic/lib/tools/_beta_session_runner.py:198
↓ 2 callersFunctionerror_response
(message: str, status: int)
tests/lib/test_refusal_fallback_streaming.py:101
↓ 2 callersMethodexecute
Execute a memory command and return the result. This method dispatches to the appropriate handler method based on the command type (v
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:108
↓ 2 callersFunctionextract_stream_chunk_type
Given a type like `Stream[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g. ```
src/anthropic/_streaming.py:542
↓ 2 callersMethodfeed
Process one event, returning the frames to forward for it.
src/anthropic/lib/middleware/_fallbacks.py:811
↓ 2 callersFunctionfield_get_default
(field: FieldInfo)
src/anthropic/_compat.py:93
↓ 2 callersMethodfinish
The outcome once the hop's stream is fully consumed (or cut early).
src/anthropic/lib/middleware/_fallbacks.py:962
↓ 2 callersMethodfinish_frames
Frames still owed when the stream ends without a chainable refusal.
src/anthropic/lib/middleware/_fallbacks.py:956
↓ 2 callersFunctionflatten
(t: Iterable[Iterable[_T]])
src/anthropic/_utils/_utils.py:33
↓ 2 callersFunctionformat_code_block
(code: str)
scripts/utils/ruffen-docs.py:107
↓ 2 callersFunctionget_environment_proxies
Gets the proxy mappings based on environment variables. We use our own logic to parse these variables, as HTTPX doesn’t allow full config
src/anthropic/_utils/_httpx.py:32
↓ 2 callersFunctionget_helper_tag
Get the helper name from an object, if any.
src/anthropic/lib/_stainless_helpers.py:92
↓ 2 callersFunctionget_model_fields
(model: type[pydantic.BaseModel])
src/anthropic/_compat.py:116
↓ 2 callersMethodget_next_page
(self: SyncPageT)
src/anthropic/_base_client.py:287
↓ 2 callersFunctionget_type_hints
( obj: Any, globalns: dict[str, Any] | None = None, localns: Mapping[str, Any] | None = None,
src/anthropic/_utils/_transform.py:455
← previousnext →401–500 of 4,863, ranked by callers