MCPcopy Create free account

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

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

↓ 2 callersFunctionaiter_work
Async version of `iter_work`. See its docstring for semantics, including how `extra_headers` is passed through per request.
src/anthropic/lib/environments/_poller.py:236
↓ 2 callersMethodapi_call_start_attributes
The attributes that the span of every API call starts with, so that a sampler sees them.
src/anthropic/lib/_tracing/_config.py:35
↓ 2 callersFunctionapply
(at: float, *step: Any)
tests/lib/tools/_fake_sessions_api.py:946
↓ 2 callersMethodapply
(self, ev: BetaManagedAgentsSessionEvent | BetaManagedAgentsStreamSessionEvents)
src/anthropic/lib/tools/_beta_session_runner.py:772
↓ 2 callersMethodapply_first_steps
(self)
tests/lib/environments/_schedules.py:48
↓ 2 callersFunctionask_for_global_tracer_provider_again
Makes the SDK forget whether OpenTelemetry could load its global tracer provider, which it asks once a process.
tests/test_open_telemetry.py:8216
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:63
↓ 2 callersFunctionassert_basic_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:237
↓ 2 callersFunctionassert_citations_response
(events: list[ParsedMessageStreamEvent[None]])
tests/lib/streaming/test_messages.py:206
↓ 2 callersFunctionassert_citations_response
(events: list[ParsedBetaMessageStreamEvent])
tests/lib/streaming/test_beta_messages.py:358
↓ 2 callersFunctionassert_compaction_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:275
↓ 2 callersFunctionassert_context_management_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:392
↓ 2 callersFunctionassert_fallback_credit_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:366
↓ 2 callersFunctionassert_fallback_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:305
↓ 2 callersFunctionassert_input_transformations_response
(message: BetaMessage, expected: List[Dict[str, str]])
tests/lib/streaming/test_beta_messages.py:417
↓ 2 callersFunctionassert_message_delta_fields_response
(message: Message)
tests/lib/streaming/test_messages.py:236
↓ 2 callersFunctionassert_message_delta_fields_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:374
↓ 2 callersFunctionassert_message_delta_omitted_usage_response
(message: Message)
tests/lib/streaming/test_messages.py:254
↓ 2 callersFunctionassert_refusal_response
(message: Message)
tests/lib/streaming/test_messages.py:228
↓ 2 callersFunctionassert_refusal_response
(message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:285
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:170
↓ 2 callersFunctionassert_server_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:338
↓ 2 callersFunctionassert_span_has_no_sampling_attributes
(span: ReadableSpan)
tests/test_open_telemetry.py:885
↓ 2 callersFunctionassert_span_has_nothing_that_message_delta_gives
(span: ReadableSpan)
tests/test_open_telemetry.py:870
↓ 2 callersFunctionassert_span_has_what_message_delta_gave
(span: ReadableSpan, *, beta: bool)
tests/test_open_telemetry.py:854
↓ 2 callersFunctionassert_time_to_first_chunk_is_set_at_the_first_delta
`times` has the type of each event that the application read, and the span's time to first chunk then.
tests/test_open_telemetry.py:709
↓ 2 callersFunctionassert_tool_use_caller_unset
(message: Message)
tests/lib/streaming/test_messages.py:218
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:118
↓ 2 callersFunctionassert_tool_use_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:265
↓ 2 callersFunctionassert_unknown_events_response
(events: list[ParsedMessageStreamEvent[None]], message: Message)
tests/lib/streaming/test_messages.py:92
↓ 2 callersFunctionassert_unknown_events_response
(events: list[ParsedBetaMessageStreamEvent], message: BetaMessage)
tests/lib/streaming/test_beta_messages.py:242
↓ 2 callersFunctionasync_client
(api: FakeApi, name: str, options: Mapping[str, Any] | None)
tests/lib/environments/_schedules.py:227
↓ 2 callersFunctionasync_collect
Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
tests/utils.py:308
↓ 2 callersFunctionasync_iter_response_bytes
(response: httpx2.Response, client: BaseClient[Any, Any])
src/anthropic/_streaming.py:478
↓ 2 callersFunctionasync_send_hop
( request: APIRequest, entry: BetaFallbackParam, call_next: AsyncCallNext )
src/anthropic/lib/middleware/_fallbacks.py:1515
↓ 2 callersFunctionattribute_value
`value` as an attribute of `type`, and `None` for a value of another type. So a body that this version of the SDK does not know sets no attribute
src/anthropic/_tracing.py:819
↓ 2 callersFunctionb64encode
(file: Base64FileInput, content: object)
src/anthropic/_utils/_prepare.py:203
↓ 2 callersMethodbegin
(self)
src/anthropic/_tracing.py:522
↓ 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:1096
↓ 2 callersFunctionbody
(_item: object)
tests/lib/environments/test_poller.py:331
↓ 2 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:630
↓ 2 callersMethodbuild
( cls: type[_T], *, response: Response, data: object, )
src/anthropic/_types.py:299
↓ 2 callersFunctionbuild_events
( *, event: BetaRawMessageStreamEvent, message_snapshot: ParsedBetaMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_beta_messages.py:389
↓ 2 callersFunctionbuild_events
( *, event: RawMessageStreamEvent, message_snapshot: ParsedMessage[ResponseFormatT], )
src/anthropic/lib/streaming/_messages.py:372
↓ 2 callersMethodcancel_tools_if
(self, condition: Callable[[str], bool])
src/anthropic/lib/tools/_beta_session_runner.py:927
↓ 2 callersMethodcheck_create_only_fields
(self, params: ThreadFields)
src/anthropic/lib/threads/_thread_state.py:507
↓ 2 callersFunctioncheck_files
`allowed` gives the committed path of each file's name in the archive
scripts/utils/check-dist.py:186
↓ 2 callersFunctioncheck_max_concurrent_calls
(value: int | None)
src/anthropic/lib/tools/_beta_session_runner.py:1068
↓ 2 callersMethodcheck_next_turn
Raise what the next turn with `overrides` would raise before it is sent.
src/anthropic/lib/threads/_thread_state.py:421
↓ 2 callersFunctioncheck_sync_hook
Raise when `hook` (`confirm`, or a family's own hook) is async and `cls` is a synchronous toolset. The asynchronous classes take either kind.
src/anthropic/lib/tools/_toolsets/_base.py:466
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_response.py:388
↓ 2 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/_streaming.py:145
↓ 2 callersMethodclose
Close the owned `httpx2.Client` if we created one.
src/anthropic/lib/credentials/_providers.py:440
↓ 2 callersMethodclose
Close the underlying `httpx2.Client` if we created it.
src/anthropic/lib/credentials/_workload.py:229
↓ 2 callersFunctionclose_stream
Closes `result` when it is a stream, which ends the span of its call.
tests/test_open_telemetry.py:3727
↓ 2 callersMethodclose_tab
(self, context: BetaToolsetCallContext, input: BetaBrowserCloseTabInput)
tests/lib/tools/toolsets/_fakes.py:150
↓ 2 callersFunctioncoerce_boolean
(val: str)
src/anthropic/_utils/_utils.py:359
↓ 2 callersFunctioncollect
Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.
tests/utils.py:297
↓ 2 callersFunctionconfirm
(context: BetaConfirmContext)
tests/lib/tools/toolsets/test_confirm.py:49
↓ 2 callersFunctionconfirm_outcome
Turn what the `confirm` callable did into the gate's decision: return to proceed, or raise the refusal the model reads. A `ToolError` that `c
src/anthropic/lib/tools/_toolsets/_base.py:532
↓ 2 callersFunctionconstructor_arguments_error
The error for a tool runner constructor call that has neither of the two sets of `arguments`, or both.
src/anthropic/lib/tools/_beta_runner.py:1739
↓ 2 callersMethodcontent_blocks
The accumulated content blocks, in start order.
src/anthropic/lib/middleware/_fallbacks.py:1283
↓ 2 callersMethodcontinuation
(self)
src/anthropic/lib/middleware/_fallbacks.py:1153
↓ 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:462
↓ 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:270
↓ 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:452
↓ 2 callersFunctioncopy_tree
Returns `[copied data]` and the slots whose file input is still to be read (in a body only).
src/anthropic/_utils/_prepare.py:85
↓ 2 callersMethodcreate_arguments
Settle the `thread` field for this turn and build its `create()` keyword arguments except `stream`: request fields, betas, the delta or full h
src/anthropic/lib/threads/_thread_state.py:386
↓ 2 callersMethodcursor_position
( self, context: BetaToolsetCallContext, input: BetaComputerCursorPositionInput )
tests/lib/tools/toolsets/_computer_fakes.py:60
↓ 2 callersFunctiondecompress
`None` unless `data` is one whole stream
scripts/utils/check-dist.py:115
↓ 2 callersFunctiondefault_tools
(session: FakeSession, observer: Observer)
tests/lib/tools/_fake_sessions_api.py:831
↓ 2 callersFunctiondefined_query
The pairs of `query`, as sent, whose parameter is one of `names`, which an endpoint defines. A name is one of them when, percent-decoded, it is i
src/anthropic/_tracing.py:724
↓ 2 callersMethoddelete
Delete File Args: file_id: ID of the File. workspace_id: Optional header to select the Workspace for this reque
src/anthropic/resources/files.py:134
↓ 2 callersFunctionempty_message
()
tests/lib/tools/test_runner_eager_tools.py:897
↓ 2 callersFunctionencoded
(payload: object)
tests/lib/environments/_fake_work_api.py:527
↓ 2 callersFunctionend_api_call_span
Ends the call span with the call's `result`. A span that already ended is left alone.
src/anthropic/_tracing.py:424
↓ 2 callersFunctionend_tool_runner_span
Ends a tool runner's span, if it has one. Never raises.
src/anthropic/lib/_tracing/_tools.py:80
↓ 2 callersFunctionerror_content
(error: ToolError)
src/anthropic/lib/tools/_toolsets/_base.py:546
↓ 2 callersFunctionerror_text_content
The text blocks of a `ToolError`'s content. Deliberate: the API accepts only text on an `is_error` result and answers anything else with a 400 tha
src/anthropic/lib/tools/_toolsets/_sanitize.py:81
↓ 2 callersFunctionevent_by_event
(canned: Reply, *, fails_before: str | None = None)
tests/lib/tools/test_runner_eager_tools.py:996
↓ 2 callersFunctionevents_before_message_delta
The events of a stream that ends before `message_delta`, whose `message_start` has every placeholder.
tests/test_open_telemetry.py:847
↓ 2 callersFunctionevents_with_first_delta
The events of `stream_events` with `delta`, twice, as the deltas of `content_block`, and a `ping` before them.
tests/test_open_telemetry.py:691
↓ 2 callersFunctionevents_without_a_delta
The events of `stream_events`, with the text block whole in its `content_block_start`.
tests/test_open_telemetry.py:719
↓ 2 callersFunctionextract_error_code
(body: object)
src/anthropic/_exceptions.py:264
↓ 2 callersFunctionfallback
The block a refusal starts when it hands the reply to a fallback model.
tests/lib/tools/test_runner_eager_tools.py:826
↓ 2 callersFunctionfallback_reply
The reply of `fallback_response()`.
tests/lib/threads/helpers.py:350
↓ 2 callersFunctionfallback_response
A reply that `FALLBACK_MODEL` wrote after `MODEL` declined, with the block that marks the hand-over.
tests/lib/threads/helpers.py:366
↓ 2 callersFunctionfallback_stream_events
The events of `stream_events`, after a `fallback` block: another model serves the rest of the response.
tests/test_open_telemetry.py:803
↓ 2 callersMethodfeed
Process one event, returning the frames to forward for it.
src/anthropic/lib/middleware/_fallbacks.py:859
↓ 2 callersFunctionfield_get_default
(field: FieldInfo)
src/anthropic/_compat.py:88
↓ 2 callersFunctionfile_name
(file: FileContent)
src/anthropic/_files.py:80
↓ 2 callersFunctionfinish
Await `result` if it is the coroutine of an async thread's `send()` or `parse()`, which runs nothing until then.
tests/lib/threads/test_beta_threads.py:2268
↓ 2 callersMethodfinish
The outcome once the hop's stream is fully consumed (or cut early).
src/anthropic/lib/middleware/_fallbacks.py:1020
↓ 2 callersMethodfinish_frames
Frames still owed when the stream ends without a chainable refusal.
src/anthropic/lib/middleware/_fallbacks.py:1014
↓ 2 callersFunctionfixed_jitter
(jitter: float)
tests/lib/environments/_schedules.py:271
↓ 2 callersFunctionflatten
(t: Iterable[Iterable[_T]])
src/anthropic/_utils/_utils.py:33
↓ 2 callersFunctionget_architecture
()
src/anthropic/_base_client.py:2838
↓ 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 callersMethodget_next_page
(self: SyncPageT)
src/anthropic/_base_client.py:323
↓ 2 callersMethodget_page_text
(self, context: BetaToolsetCallContext, input: BetaBrowserGetPageTextInput)
tests/lib/tools/toolsets/_fakes.py:116
← previousnext →1,101–1,200 of 14,068, ranked by callers