MCPcopy Create free account

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

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

↓ 6 callersMethod_build_workload_delegate
(self, auth: Dict[str, Any])
src/anthropic/lib/credentials/_providers.py:616
↓ 6 callersFunction_format_file_size
(bytes_size: int)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:363
↓ 6 callersFunction_install_run_session_tools
(monkeypatch: pytest.MonkeyPatch, record: dict[str, Any])
tests/lib/environments/test_worker.py:123
↓ 6 callersFunction_json_dumps
(value: Any)
src/anthropic/lib/middleware/_fallbacks.py:1446
↓ 6 callersFunction_mock_token_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:1853
↓ 6 callersFunction_redact_body
Truncate a token-endpoint error body for safe inclusion in an exception.
src/anthropic/lib/credentials/_workload.py:49
↓ 6 callersFunction_result_text
Concatenated text of the posted-back result's text blocks.
tests/lib/tools/test_session_runner.py:103
↓ 6 callersMethod_walk_sync_auth
(client: Anthropic)
tests/lib/test_credentials.py:2938
↓ 6 callersMethodaiter_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:449
↓ 6 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
↓ 6 callersFunctionasync_to_httpx_files
(files: None)
src/anthropic/_files.py:86
↓ 6 callersFunctionbeta_async_tool
(func: AsyncFunctionT)
src/anthropic/lib/tools/_beta_functions.py:468
↓ 6 callersMethodgenerate_tool_call_response
Generate a MessageParam by calling tool functions with any tool use blocks from the last message. Note the tool call response is cached, repe
src/anthropic/lib/tools/_beta_runner.py:306
↓ 6 callersMethodhandle_item
Service a single, already-claimed work item without the poll loop. Builds the per-session :class:`AgentToolContext` (workdir from this
src/anthropic/lib/environments/_worker.py:323
↓ 6 callersMethodinvalidate
Clear the cached token so the next :meth:`get_token` re-invokes the provider. Also sets a one-shot ``force_refresh`` flag so on-disk provider
src/anthropic/lib/credentials/_cache.py:177
↓ 6 callersFunctionis_annotated_type
(typ: type)
src/anthropic/_utils/_typing.py:21
↓ 6 callersMethodjson
(self)
src/anthropic/_streaming.py:405
↓ 6 callersFunctionmcp_resource_to_content
Convert MCP resource contents to an Anthropic content block. Finds the first resource with a supported MIME type from the result's ``contents
src/anthropic/lib/tools/mcp.py:252
↓ 6 callersFunctionquote
Add single quotation marks around the given string. Does *not* do any escaping.
src/anthropic/_utils/_utils.py:221
↓ 6 callersMethodrun
Poll the environment and service each claimed session until cancelled. Loops forever; cancel the task (or wrap it in :func:`asyncio.wait_for`
src/anthropic/lib/environments/_worker.py:292
↓ 6 callersMethodstop
Track a content_block_stop, shifting `event["index"]`.
src/anthropic/lib/middleware/_fallbacks.py:1231
↓ 6 callersFunctionto_httpx_files
(files: None)
src/anthropic/_files.py:44
↓ 6 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
↓ 6 callersMethodwith_middleware
A new client with the given middleware appended after this client's middleware. Convenience for applying extra middleware to a single request
src/anthropic/_client.py:500
↓ 5 callersMethod__init__
( self, *, url: URL, )
src/anthropic/_base_client.py:148
↓ 5 callersFunction_backoff
(attempt: int)
src/anthropic/lib/environments/_poller.py:30
↓ 5 callersFunction_custom_tool_use
A CUSTOM (user-defined) tool call — the agent emits ``agent.custom_tool_use`` rather than ``agent.tool_use`` for these.
tests/lib/tools/test_session_runner.py:79
↓ 5 callersFunction_is_fatal_4xx
(err: Exception)
src/anthropic/lib/environments/_poller.py:38
↓ 5 callersFunction_is_status
(err: Exception, code: int)
src/anthropic/lib/environments/_poller.py:42
↓ 5 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
↓ 5 callersFunction_require_https
Reject non-``https://`` token-endpoint URLs. Localhost is allowed for testing so ``base_url="http://localhost:8080"`` works against a local `
src/anthropic/lib/credentials/_constants.py:116
↓ 5 callersFunction_to_session_content
(content: Any)
tests/lib/tools/test_session_runner.py:969
↓ 5 callersFunction_within
True if ``child`` is ``root`` or a path inside it (both already resolved).
src/anthropic/lib/tools/_skills.py:35
↓ 5 callersFunctionasyncify
Take a blocking function and create an async one that receives the same positional and keyword arguments. Usage: ```python def
src/anthropic/_utils/_sync.py:28
↓ 5 callersFunctionbeta_glob_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:597
↓ 5 callersMethodcopy
( self, *, method: str | NotGiven = not_given, url: str | NotGiven = not_given
src/anthropic/_request.py:69
↓ 5 callersFunctioncreate_message_async
(client: AsyncAnthropic)
tests/lib/test_refusal_fallback.py:89
↓ 5 callersFunctionhelper_header
The ``x-stainless-helper: <value>`` header dict, for passing into a ``merge_headers`` call or as ``extra_headers``/``default_headers``. Typin
src/anthropic/lib/_stainless_helpers.py:72
↓ 5 callersFunctionhop_refusal
A fallback hop that contributes one text block, then refuses with a fresh token.
tests/lib/test_refusal_fallback_streaming.py:668
↓ 5 callersFunctionis_mapping_t
(obj: _MappingT | object)
src/anthropic/_utils/_utils.py:190
↓ 5 callersMethoditer_bytes
A byte-iterator over the decoded response content. This automatically handles gzip, deflate and brotli encoded responses.
src/anthropic/_response.py:387
↓ 5 callersFunctioniter_next
(iter: Iterator[_T] | AsyncIterator[_T])
tests/decoders/test_jsonl.py:68
↓ 5 callersMethodlist
List available models. The Models API response can be used to determine which models are available for use in the API. More
src/anthropic/resources/models.py:89
↓ 5 callersFunctionmake_lenient_client
A client with the default (non-strict) response validation. The fixture wire's terminal refusal delta self-reports a `{type: "message"}` iter
tests/lib/test_refusal_fallback_streaming.py:81
↓ 5 callersFunctionmcp_tool
Convert an MCP tool to a sync runnable tool for ``tool_runner()``. Example:: from anthropic.lib.tools.mcp import mcp_tool tools
src/anthropic/lib/tools/mcp.py:329
↓ 5 callersFunctionprint_obj
Pretty print an object to a string
tests/lib/utils.py:18
↓ 5 callersMethodprovider
(*, force_refresh: bool = False)
tests/lib/test_credentials.py:1553
↓ 5 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1822
↓ 5 callersFunctionserving_stream
(model: str = FALLBACK_MODEL, message_id: str = "msg_b")
tests/lib/test_refusal_fallback_streaming.py:922
↓ 5 callersFunctionset_pydantic_config
Add a pydantic config for the given type. Note: this is a no-op on Pydantic v1.
src/anthropic/_models.py:836
↓ 4 callersMethod__init__
(self, message: str, request: httpx.Request, *, body: object | None)
src/anthropic/_exceptions.py:44
↓ 4 callersFunction_async_secure_mkdir
(path: AsyncPath, mode: int = _DIR_CREATE_MODE)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:647
↓ 4 callersMethod_calculate_retry_timeout
( self, remaining_retries: int, options: FinalRequestOptions, response_headers
src/anthropic/_base_client.py:818
↓ 4 callersFunction_chunk_bytes_to_sse
(raw: bytes)
src/anthropic/lib/bedrock/_stream_decoder.py:68
↓ 4 callersFunction_drain_one
Pull a single item from a sync iterator; assert there was one.
tests/lib/environments/test_poller_method.py:116
↓ 4 callersFunction_fs_error
Map a filesystem ``OSError`` to a consistent, runtime-independent message. The raw ``OSError`` string is platform-specific (``[Errno 2] ENOENT: .
src/anthropic/lib/tools/agent_toolset.py:126
↓ 4 callersMethod_get_http_client
Return an ``httpx.Client``, lazily creating (and tracking) one we own.
src/anthropic/lib/credentials/_providers.py:379
↓ 4 callersMethod_get_last_message
(self)
src/anthropic/lib/tools/_beta_runner.py:377
↓ 4 callersMethod_get_last_message
(self)
src/anthropic/lib/tools/_beta_runner.py:609
↓ 4 callersFunction_get_open_connections
(client: Anthropic | AsyncAnthropic)
tests/test_client.py:107
↓ 4 callersFunction_install_aiter_work
(monkeypatch: pytest.MonkeyPatch, items: list[Any])
tests/lib/environments/test_worker.py:115
↓ 4 callersFunction_is_base_client
True only for the base ``Anthropic`` / ``AsyncAnthropic`` classes, not subclasses. Subclasses (``AnthropicAWS``, ``AnthropicFoundry``) have their
src/anthropic/_client.py:56
↓ 4 callersMethod_load_config
Read and cache the config file, resolving ``base_url`` and ``credentials_path``.
src/anthropic/lib/credentials/_providers.py:270
↓ 4 callersFunction_message_json
()
tests/lib/test_stainless_helpers.py:34
↓ 4 callersMethod_process_response_data
( self, *, data: object, cast_to: type[ResponseT], response: httpx.Res
src/anthropic/_base_client.py:678
↓ 4 callersFunction_read_env
Return the first non-None value from the given env vars, or None.
src/anthropic/lib/aws/_credentials.py:22
↓ 4 callersFunction_require
Fall back to ``env_var`` for ``value``; raise a clear error if still empty. The ``ANTHROPIC_*`` env vars are the ones the ``ant worker poll --on-
src/anthropic/lib/environments/_worker.py:154
↓ 4 callersFunction_safe_member_name
Return ``name`` as a confined relative path, or raise on path-traversal. Strips ``.`` components; rejects absolute paths and any ``..`` component
src/anthropic/lib/tools/_skills.py:44
↓ 4 callersFunction_secure_mkdir
Create ``path`` and any missing parents with ``mode``, regardless of umask. ``Path.mkdir(parents=True, mode=...)`` and ``os.makedirs(mode=...)``
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:306
↓ 4 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
↓ 4 callersFunction_work_item
(*, work_type: str = "session", work_id: str = "w_1", session_id: str = "s_1")
tests/lib/environments/test_worker.py:111
↓ 4 callersMethodaread
(self)
src/anthropic/_legacy_response.py:484
↓ 4 callersFunctionassert_message_matches
(message: BetaMessage, expected: Dict[str, Any])
tests/lib/streaming/test_beta_messages.py:194
↓ 4 callersFunctionassert_signatures_in_sync
Ensure that the signature of the second function matches the first.
src/anthropic/_utils/_reflection.py:14
↓ 4 callersFunctionbeta_grep_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:642
↓ 4 callersFunctionbeta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:161
↓ 4 callersMethodclose
Close the underlying HTTPX client. The client will *not* be usable after this.
src/anthropic/_base_client.py:1043
↓ 4 callersMethodclose
(self)
src/anthropic/lib/middleware/_fallbacks.py:1550
↓ 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:84
↓ 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:81
↓ 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:283
↓ 4 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
↓ 4 callersFunctionget_auth_headers
( *, method: str, url: str, headers: httpx.Headers, aws_access_key: str | None, aws_se
src/anthropic/lib/bedrock/_auth.py:33
↓ 4 callersFunctionget_helper_tag
Get the helper name from an object, if any.
src/anthropic/lib/_stainless_helpers.py:92
↓ 4 callersFunctionhelper_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:420
↓ 4 callersFunctionis_type_alias_type
Return whether the provided argument is an instance of `TypeAliasType`. ```python type Int = int is_type_alias_type(Int) # > True
src/anthropic/_utils/_typing.py:59
↓ 4 callersMethoditer_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:427
↓ 4 callersFunctionmake_async_client
(**kwargs: Any)
tests/lib/test_refusal_fallback.py:36
↓ 4 callersFunctionmcp_message
Convert an MCP prompt message to an Anthropic ``BetaMessageParam``.
src/anthropic/lib/tools/mcp.py:231
↓ 4 callersFunctionparse_obj
(model: type[_ModelT], value: object)
src/anthropic/_compat.py:80
↓ 4 callersFunctionparse_text
(text: str, output_format: ResponseFormatT | NotGiven)
src/anthropic/lib/_parse/_response.py:16
↓ 4 callersMethodunwrap
(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None)
src/anthropic/resources/beta/webhooks.py:17
↓ 4 callersFunctionupdate_env
(**new_env: str | Omit)
tests/utils.py:154
↓ 4 callersMethodworker
()
tests/lib/test_credentials.py:1527
↓ 4 callersFunctionwrite
Write a file, creating parent directories as needed.
src/anthropic/lib/tools/agent_toolset.py:532
↓ 3 callersMethod__init__
(self, *, cache_control: BetaCacheControlEphemeralParam | None = None)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:87
↓ 3 callersMethod__stream__
(self)
src/anthropic/_streaming.py:86
↓ 3 callersFunction_add
(tag: str | None)
src/anthropic/lib/_stainless_helpers.py:104
↓ 3 callersFunction_adrain_one
(ait: AsyncIterator[Any])
tests/lib/environments/test_poller_method.py:124
↓ 3 callersFunction_async_read_file_content
(full_path: AsyncPath, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:651
← previousnext →201–300 of 4,447, ranked by callers