MCPcopy Create free account

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

Functions12,274 in github.com/anthropics/anthropic-sdk-python

↓ 4 callersFunctionbeta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:170
↓ 4 callersFunctionbody
()
tests/decoders/test_jsonl.py:19
↓ 4 callersFunctionbounded_result
`result` as it is rendered: the line a pure action returned is folded to one line and cut, so one that is only whitespace or control characters be
src/anthropic/lib/tools/_toolsets/_computer.py:410
↓ 4 callersFunctionchat_message
(role: str, *parts: dict[str, Any])
tests/test_open_telemetry.py:295
↓ 4 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/lib/streaming/_beta_messages.py:93
↓ 4 callersMethodclose
Close the response and release the connection. Automatically called if the response body is read to completion.
src/anthropic/lib/streaming/_messages.py:88
↓ 4 callersFunctioncommon_arguments
(client_class: ClientClass)
tests/lib/test_client_copy.py:194
↓ 4 callersFunctionconfirm_context
What the `confirm` callable is told: the member, its parsed input and the `tool_use` being answered. Built from values the pipeline already holds,
src/anthropic/lib/tools/_toolsets/_computer.py:425
↓ 4 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:273
↓ 4 callersFunctioncount
How many items the list `value` has, and `None` for anything else, such as a list that the request lacks.
src/anthropic/lib/_tracing/_attributes.py:54
↓ 4 callersFunctioncreate
(client: AnthropicBedrockMantle, user_profile_id: str | Omit, extra_body: object)
tests/lib/test_bedrock_mantle.py:457
↓ 4 callersMethodcreate
Create a new memory file with the specified content.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:141
↓ 4 callersFunctioncut_tool_stream_events
The events of `tool_stream_events` up to a delta that leaves the input of its `tool_use` block open.
tests/test_open_telemetry.py:781
↓ 4 callersFunctionerror_text
`repr(exc)` as the `is_error` result the model reads, well formed and cut to the field limit: a driver's exception can embed a page-sized payload
src/anthropic/lib/tools/_toolsets/_sanitize.py:75
↓ 4 callersFunctionevents_up_to_message_delta
The events of a stream that ends before `message_stop`, whose `message_delta` has all that one can have.
tests/test_open_telemetry.py:836
↓ 4 callersFunctionextract_type_arg
(typ: type, index: int)
src/anthropic/_utils/_typing.py:83
↓ 4 callersFunctionfield_outer_type
(field: FieldInfo)
src/anthropic/_compat.py:99
↓ 4 callersFunctionfinish_api_call_span
Records the call's `result` on its span, and ends the span. The body of a stream or of an unread raw response keeps the span until the applicatio
src/anthropic/lib/_tracing/_api_call.py:39
↓ 4 callersFunctionfolded
`text` on one line, not yet cut: line breaks, control and bidi characters folded to spaces, a lone surrogate to U+FFFD, the ends trimmed. For a va
src/anthropic/lib/tools/_toolsets/_sanitize.py:52
↓ 4 callersFunctionget_async_library
()
src/anthropic/_utils/_utils.py:435
↓ 4 callersMethodget_tracer
(self, *args: Any, **kwargs: Any)
tests/test_open_telemetry.py:8151
↓ 4 callersMethodhash_file
One file's sha256; `None` when absent. Shares `hashtree`'s cache.
src/anthropic/lib/tools/_file_store.py:203
↓ 4 callersFunctionhelper_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:691
↓ 4 callersFunctionhook_refusal
The rule for an exception out of a developer hook (`confirm`, `url_policy`, the file policy): a `ToolsetUsageError` stops the run, a `ToolError` i
src/anthropic/lib/tools/_toolsets/_runnable.py:235
↓ 4 callersFunctionid_headers
The response headers that a reply's `_request_id` and `_workspace_id` come from.
tests/lib/threads/helpers.py:322
↓ 4 callersFunctioninterrupted_stream_response
A streamed reply cut off in its text block, once `text` has arrived: the body ends there, or reading on raises `error`.
tests/lib/threads/helpers.py:492
↓ 4 callersFunctionis_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:21
↓ 4 callersFunctionis_async_token_provider
True for an `async def` function, an object whose `__call__` is one, or a `functools.partial` of either.
src/anthropic/lib/credentials/_types.py:85
↓ 4 callersMethodis_closed
Whether or not the response body has been closed. If this is False then there is response data that has not been read yet. You must e
src/anthropic/_response.py:115
↓ 4 callersMethodis_path_visible
(self, path: str)
src/anthropic/lib/tools/_toolsets/_security.py:238
↓ 4 callersMethoditem
(self, item: object)
src/anthropic/_tracing.py:526
↓ 4 callersMethodls
The relative path of every file under the directory `under`.
src/anthropic/lib/tools/_file_store.py:169
↓ 4 callersFunctionmake_async_client
()
tests/lib/threads/helpers.py:58
↓ 4 callersFunctionmake_jsonl_iterator
( content: Iterator[bytes], *, sync: bool, line_type: type[_T], )
tests/decoders/test_jsonl.py:138
↓ 4 callersFunctionmcp_message
Convert an MCP prompt message to an Anthropic `BetaMessageParam`.
src/anthropic/lib/tools/mcp.py:230
↓ 4 callersFunctionmock_results
(respx_mock: MockRouter)
tests/api_resources/beta/messages/test_batches.py:23
↓ 4 callersFunctionmock_results
(respx_mock: MockRouter)
tests/api_resources/messages/test_batches.py:23
↓ 4 callersMethodmove
Rename `src` to `dst`; an existing `dst` is refused. The banned store root as either end does nothing.
src/anthropic/lib/tools/_file_store.py:220
↓ 4 callersFunctionopenapi_dumps_str
`openapi_dumps`, as a `str`; for transports that send text frames.
src/anthropic/_utils/_json.py:30
↓ 4 callersFunctionparse_obj
(model: type[_ModelT], value: object)
src/anthropic/_compat.py:75
↓ 4 callersFunctionparse_text
(text: str, output_format: ResponseFormatT | NotGiven)
src/anthropic/lib/_parse/_response.py:16
↓ 4 callersFunctionprint_obj
Pretty print an object to a string
tests/lib/utils.py:18
↓ 4 callersFunctionquote
Add single quotation marks around the given string. Does *not* do any escaping.
src/anthropic/_utils/_utils.py:221
↓ 4 callersMethodrecord
(self, tool_use: BetaToolUseBlock, result: BetaToolResultBlockParam)
src/anthropic/lib/tools/_beta_runner.py:1707
↓ 4 callersMethodrecord_reply
Record `message` as the turn's reply, for the next turn to continue from. A refused turn is not recorded, and the next turn starts a new threa
src/anthropic/lib/threads/_thread_state.py:310
↓ 4 callersFunctionrequester
A method shaped like a generated streaming method, whose response is `body`.
tests/utils.py:226
↓ 4 callersFunctionresponse_ids
(*replies: BetaMessage)
tests/lib/threads/helpers.py:327
↓ 4 callersMethodresult
The result of the call, as far as the call has got.
src/anthropic/_tracing.py:342
↓ 4 callersMethodretrieve
Get a specific model. The Models API response can be used to determine information about a specific model or resolve a model
src/anthropic/resources/models.py:45
↓ 4 callersFunctionrun_with_a_browser_toolset
Runs the loop of a tool runner that has a browser toolset on `reply` and then `FINAL`, and returns the route. A streamed reply is read to its end
tests/lib/tools/test_open_telemetry.py:258
↓ 4 callersFunctionsame_message
Whether `a` and `b` are sent as the same message. A recorded reply holds its content blocks as models, and the caller gives the same blocks back a
src/anthropic/lib/threads/_thread_state.py:635
↓ 4 callersFunctionset_content_attributes
Sets the content attributes of `span` within `limit`, the client's `max_content_bytes`. `limit` is in bytes of UTF-8. Each of `attributes` is set
src/anthropic/lib/_tracing/_content.py:118
↓ 4 callersFunctionshare_message_snapshot
Lets the span of the API call that returned `stream` take its output content from `reader`.
src/anthropic/lib/_tracing/_streaming.py:152
↓ 4 callersFunctionsignature_without_evaluating_annotations
Like `inspect.signature()`, for callers that only need parameter names, kinds and defaults. Python 3.14 evaluates annotations lazily and `inspect
src/anthropic/_utils/_reflection.py:9
↓ 4 callersFunctionslow_stream_closes
Makes closing a response stream wait, as closing a connection does, and lists each close as it starts and finishes.
tests/lib/tools/test_open_telemetry.py:222
↓ 4 callersMethodstart_turn
Stage `messages` and start the turn that sends them. The turn goes out even if nothing is staged then.
src/anthropic/lib/threads/_thread_state.py:248
↓ 4 callersMethodstate
(self, context: BetaToolsetCallContext)
tests/lib/tools/toolsets/_fakes.py:64
↓ 4 callersFunctionthread_logs
The (level, message) pairs logged under the `anthropic.lib.threads` logger or its children.
tests/lib/threads/helpers.py:954
↓ 4 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:821
↓ 4 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:737
↓ 4 callersFunctiontool_change_replies
The replies of a run that calls `get_weather`, then `lookup`, then `get_weather` again, and then ends.
tests/lib/threads/helpers.py:372
↓ 4 callersFunctiontool_change_turns
What answers each of the first three `tool_change_replies()` when `lookup` is added while the first one is handled and `get_weather` is removed wh
tests/lib/threads/helpers.py:382
↓ 4 callersFunctiontool_error_content
Render an exception raised by a tool as tool-result content. A `ToolError` has its own structured content, made well formed but never cut. An
src/anthropic/lib/tools/_tool_dispatch.py:247
↓ 4 callersFunctiontool_result_content
(content: None)
src/anthropic/lib/tools/_tool_dispatch.py:262
↓ 4 callersFunctionunwrap_partial
(obj: object)
src/anthropic/lib/credentials/_types.py:79
↓ 4 callersFunctionvalidate_output_config_conflict
Reject a call that passes both `output_format` and `output_config.format`.
src/anthropic/lib/_parse/_transform.py:19
↓ 4 callersFunctionwithhold_message_snapshot
Keeps the snapshot shared for `stream` out of the output content of the span of its API call. The stream helper could not accumulate an event, so
src/anthropic/lib/_tracing/_streaming.py:158
↓ 4 callersFunctionwithout_speed
(body: dict[str, Any])
tests/lib/test_refusal_fallback.py:122
↓ 4 callersFunctionwithout_speed
(body: dict[str, Any])
tests/lib/test_refusal_fallback_streaming.py:175
↓ 3 callersMethod__init__
(self, *, cache_control: BetaCacheControlEphemeralParam | None = None)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:89
↓ 3 callersMethod__init__
( self, cls: type[BaseToolset[Any, Any, Any]], *, configs: BetaComputerToolset
src/anthropic/lib/tools/_toolsets/_computer.py:74
↓ 3 callersMethod_apply_verdict
Dispatch or resolve a gated call according to the user's verdict. The idle-clock hold accounting lives here: a denial drops the held
src/anthropic/lib/tools/_beta_session_runner.py:864
↓ 3 callersFunction_async_read_file_content
(full_path: AsyncPath, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:669
↓ 3 callersFunction_backoff
(attempt: int)
src/anthropic/lib/environments/_poller.py:33
↓ 3 callersFunction_beat_ok
(ttl_seconds: int = 0)
tests/lib/environments/test_worker.py:1121
↓ 3 callersFunction_canonicalize
Return `path` with `.`/`..` collapsed lexically and every symlink followed, or raise `OSError` — the same outcome on every supported Python, a
src/anthropic/lib/tools/agent_toolset.py:352
↓ 3 callersMethod_check_can_compact
(self, params: ParseMessageCreateParamsBase[ResponseFormatT])
src/anthropic/lib/tools/_beta_runner.py:379
↓ 3 callersFunction_config_dir
Resolve the config directory. `ANTHROPIC_CONFIG_DIR` env var → platform default. Platform defaults: * Linux & macOS: `~/.config/anthro
src/anthropic/lib/credentials/_constants.py:63
↓ 3 callersMethod_copy_and_prepare
A copy of `options` with `extra_body` merged into the body, and the body and query prepared. The data is walked once per request, before the
src/anthropic/_base_client.py:1476
↓ 3 callersMethod_copy_open_telemetry
The `open_telemetry` option of a copy of this client: the one given, or else, for `None`, this client's own. The one given replaces this clie
src/anthropic/_base_client.py:492
↓ 3 callersFunction_determine_next_step_from_stop_reason
Decide how the runner loop treats a finished assistant turn. - `run_tools`: run the turn's client tool calls, append their results and continue;
src/anthropic/lib/tools/_beta_runner.py:121
↓ 3 callersFunction_fs_error
(op: str, file_path: str, e: OSError)
src/anthropic/lib/tools/agent_toolset.py:187
↓ 3 callersMethod_get_page_items
(self)
src/anthropic/_base_client.py:245
↓ 3 callersFunction_install_session_ended_by_heartbeat
A session that never completes on its own, with the fake heartbeat held back until the runner is serving it: the heartbeat's outcome — not skill
tests/lib/environments/test_worker.py:470
↓ 3 callersFunction_is_fatal_4xx
(err: Exception)
src/anthropic/lib/environments/_poller.py:41
↓ 3 callersFunction_is_supported_image_type
(mime_type: str)
src/anthropic/lib/tools/mcp.py:102
↓ 3 callersFunction_iter
()
tests/lib/environments/test_worker.py:221
↓ 3 callersFunction_jitter
(low: float, high: float)
src/anthropic/lib/environments/_poller.py:37
↓ 3 callersFunction_json_dumps_secrets
`json.dumps` with `SecretStr` values unwrapped at dump time. Returns bytes so call sites can pass the result inline (request content, `os.wri
src/anthropic/lib/credentials/_secrets.py:95
↓ 3 callersMethod_list_memories
The store's memories — `basic` view (shas, no content) at `_LIST_PAGE_SIZE` per page unless the caller needs `full` pages. `memory_pre
src/anthropic/lib/tools/_memories.py:779
↓ 3 callersFunction_make_tar
(path: Path, members: list[tuple[tarfile.TarInfo, bytes]])
tests/lib/tools/test_skills.py:118
↓ 3 callersFunction_make_zip_infos
(path: Path, entries: list[tuple[zipfile.ZipInfo, bytes]])
tests/lib/tools/test_skills.py:131
↓ 3 callersFunction_messages
(caplog: pytest.LogCaptureFixture)
tests/lib/environments/test_worker.py:1139
↓ 3 callersFunction_missing_target_fixture
Workdir with two links to `deep/t`, which doesn't exist. With `..` collapsed by name, both targets read as `t`, whose entries link outside.
tests/lib/tools/test_agent_toolset.py:1005
↓ 3 callersFunction_mock_skill
Mocks the lookup of the skill's version, and returns the route of its download.
tests/lib/tools/test_skills.py:454
↓ 3 callersFunction_prepare_options
(input_options: FinalRequestOptions, *, project_id: str | None, region: str)
src/anthropic/lib/vertex/_client.py:387
↓ 3 callersFunction_read_file_content
(full_path: Path, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:356
↓ 3 callersFunction_redact_body
Truncate a token-endpoint error body for safe inclusion in an exception.
src/anthropic/lib/credentials/_workload.py:55
↓ 3 callersFunction_reject_read_only
Raise `ToolError` when `target` falls under a read-only root. Roots resolve at check time, exactly like `allowed_roots` in `resolve_path` — a
src/anthropic/lib/tools/agent_toolset.py:422
↓ 3 callersMethod_request_api_list
( self, model: Type[object], page: Type[SyncPageT], options: FinalRequestOptio
src/anthropic/_base_client.py:1560
← previousnext →601–700 of 12,274, ranked by callers