MCPcopy Create free account

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

Functions5,068 in github.com/anthropics/anthropic-sdk-python

↓ 2 callersMethodaiter_bytes
(self, chunk_size: int | None = None)
src/anthropic/_legacy_response.py:491
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:35
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:205
↓ 2 callersFunctionassert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:220
↓ 2 callersFunctionassert_context_management_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:329
↓ 2 callersFunctionassert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:303
↓ 2 callersFunctionassert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:250
↓ 2 callersFunctionassert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:174
↓ 2 callersFunctionassert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:311
↓ 2 callersFunctionassert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:192
↓ 2 callersFunctionassert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:166
↓ 2 callersFunctionassert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:230
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:116
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:283
↓ 2 callersFunctionassert_tool_use_caller_unset
(message: Message)
tests/lib/streaming/test_messages.py:156
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:64
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:210
↓ 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:845
↓ 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:763
↓ 2 callersFunctionbackoff
Exponential backoff for ``attempt`` (1-indexed), capped at ``cap``.
src/anthropic/lib/_retry.py:32
↓ 2 callersMethodbegin
The chain state after stream A's chainable refusal. `body` is the original request params (pre-pin) — the base every hop patches; `in
src/anthropic/lib/middleware/_fallbacks.py:1067
↓ 2 callersFunctionbuild_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:344
↓ 2 callersFunctionbuild_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:339
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:384
↓ 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:437
↓ 2 callersMethodclose
Close the underlying ``httpx.Client`` if we created it.
src/anthropic/lib/credentials/_workload.py:233
↓ 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:1242
↓ 2 callersMethodcontinuation
(self)
src/anthropic/lib/middleware/_fallbacks.py:1124
↓ 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:377
↓ 2 callersMethoddisarm
Cancel the idle countdown; only signals on an actual transition.
src/anthropic/lib/tools/_beta_session_runner.py:207
↓ 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:840
↓ 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:991
↓ 2 callersMethodfinish_frames
Frames still owed when the stream ends without a chainable refusal.
src/anthropic/lib/middleware/_fallbacks.py:985
↓ 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_architecture
()
src/anthropic/_base_client.py:2516
↓ 2 callersFunctionget_auth_headers
( *, method: str, url: str, headers: httpx.Headers, aws_access_key: str | None, aws_se
src/anthropic/lib/bedrock/_auth.py:33
↓ 2 callersMethodget_credentials
(self)
tests/lib/test_aws_auth.py:590
↓ 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:286
↓ 2 callersFunctionget_platform
()
src/anthropic/_base_client.py:2437
↓ 2 callersFunctionget_tool_use_response_without_caller
()
tests/lib/streaming/test_messages.py:152
↓ 2 callersMethodhandler
(req: APIRequest)
tests/test_middleware.py:502
↓ 2 callersMethodhas_next_page
(self)
src/anthropic/_base_client.py:202
↓ 2 callersMethodhold
Pause the countdown while a gated call is held or in flight.
src/anthropic/lib/tools/_beta_session_runner.py:214
↓ 2 callersMethodhop_body
The hop's request body: the entry applied as a patch against the ORIGINAL request params (never a previous hop's patched body), extended
src/anthropic/lib/middleware/_fallbacks.py:1127
↓ 2 callersFunctionis_base64_file_input
(obj: object)
src/anthropic/_files.py:25
↓ 2 callersFunctionis_basemodel
Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`
src/anthropic/_models.py:533
↓ 2 callersFunctionis_basemodel_type
(type_: type)
src/anthropic/_models.py:545
↓ 2 callersFunctionis_iterable_type
If the given type is `typing.Iterable[T]`
src/anthropic/_utils/_typing.py:34
↓ 2 callersFunctionis_literal_type
(type_: type[Any])
src/anthropic/_compat.py:39
↓ 2 callersFunctionis_required_type
(typ: type)
src/anthropic/_utils/_typing.py:44
↓ 2 callersFunctionis_sequence
(obj: object)
src/anthropic/_utils/_utils.py:178
↓ 2 callersFunctionis_sequence_t
(obj: _SequenceT | object)
src/anthropic/_utils/_utils.py:182
↓ 2 callersFunctionis_stream_class_type
TypeGuard for determining whether or not the given type is a subclass of `Stream` / `AsyncStream`
src/anthropic/_streaming.py:536
↓ 2 callersFunctionis_typeddict
(tp: Type[Any])
src/anthropic/_utils/_compat.py:32
↓ 2 callersFunctionis_union
(tp: type[Any] | None)
src/anthropic/_compat.py:33
↓ 2 callersMethoditer_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:427
↓ 2 callersFunctionjitter
Uniform random delay in ``[low, high)`` — spreads out retry storms.
src/anthropic/lib/_retry.py:37
↓ 2 callersMethodjson
Read and decode the JSON response content.
src/anthropic/_response.py:379
↓ 2 callersMethodjson
(self)
src/anthropic/_streaming.py:405
↓ 2 callersFunctionmake_async_vertex_client
(**kwargs: Any)
tests/test_middleware.py:1837
↓ 2 callersMethodmark_opened
(self)
src/anthropic/lib/middleware/_fallbacks.py:1120
↓ 2 callersFunctionmodel_parse
(model: type[_ModelT], data: Any)
src/anthropic/_compat.py:175
↓ 2 callersFunctionparse_beta_response
( *, output_format: ResponseFormatT | NotGiven, response: BetaMessage, )
src/anthropic/lib/_parse/_response.py:23
↓ 2 callersFunctionparse_response
( *, output_format: ResponseFormatT | NotGiven, response: Message, )
src/anthropic/lib/_parse/_response.py:49
↓ 2 callersMethodpending_seam_frames
(self)
src/anthropic/lib/middleware/_fallbacks.py:1117
↓ 2 callersMethodpoll
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:390
↓ 2 callersMethodqueue_seam
Queue the reached hop's `fallback` seam block at the next monotonic index. Queued seams are flushed by the hop reader once output reaches the
src/anthropic/lib/middleware/_fallbacks.py:1093
↓ 2 callersMethodraw_events
Iterate the raw Server-Sent Events from `response`, before any JSON parsing or event-name filtering. This reads the response body dir
src/anthropic/_streaming.py:78
↓ 2 callersMethodrefresh
(self, _request: object)
tests/lib/test_vertex.py:258
↓ 2 callersFunctionresolve_identity_token_path
ctor arg → ``ANTHROPIC_IDENTITY_TOKEN_FILE`` → ``None``.
src/anthropic/lib/credentials/_constants.py:220
↓ 2 callersFunctionrun_runnable_tool
Call ``tool`` with ``input``, awaiting the result if the tool is async. Sync tools run on a worker thread. If the caller cancels (for example on
src/anthropic/lib/tools/_tool_dispatch.py:124
↓ 2 callersFunctionshort_circuit_message
(*, model: str = "claude-opus-4-6")
tests/test_middleware.py:362
↓ 2 callersFunctionstart
(event_id: str)
tests/lib/sessions/test_accumulate.py:21
↓ 2 callersMethodstringify_items
( self, params: Params, *, array_format: ArrayFormat | NotGiven = not_given,
src/anthropic/_qs.py:51
↓ 2 callersMethodterminal_failure_frames
Degrade to the suppressed refusal when every remaining entry failed over HTTP: replay its message_delta verbatim — `recommended_model`
src/anthropic/lib/middleware/_fallbacks.py:1161
↓ 2 callersFunctionto_aiter
(iter: Iterator[bytes])
tests/test_streaming.py:249
↓ 2 callersFunctionto_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:822
↓ 2 callersFunctionto_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:738
↓ 2 callersMethodtoken
Return a valid access token, loading ADC / refreshing as needed. Blocking.
src/anthropic/lib/google_cloud/_client.py:63
↓ 2 callersFunctiontool_registry
Index ``tools`` by their ``name`` for O(1) dispatch lookup. On a duplicate name the later tool wins, matching a plain dict comprehension.
src/anthropic/lib/tools/_tool_dispatch.py:49
↓ 2 callersMethodunwrap
(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None)
src/anthropic/resources/beta/webhooks.py:17
↓ 2 callersFunctionvalidate_output_format
(output_format: object)
src/anthropic/resources/beta/messages/messages.py:4194
↓ 2 callersFunctionvalidate_type
Strict validation that the given value matches the expected type
src/anthropic/_models.py:834
↓ 1 callersMethod__aexit__
(self, *exc: object)
src/anthropic/lib/tools/agent_toolset.py:304
↓ 1 callersMethod__as_proxied__
Helper method that returns the current proxy, typed as the loaded object
src/anthropic/_utils/_proxy.py:60
↓ 1 callersMethod__decode__
(self)
src/anthropic/_decoders/jsonl.py:43
↓ 1 callersMethod__decode__
(self)
src/anthropic/_decoders/jsonl.py:99
← previousnext →501–600 of 5,068, ranked by callers