MCPcopy Create free account

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

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

↓ 6 callersMethodto_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:183
↓ 6 callersFunctionto_httpx_files
(files: None)
src/anthropic/_files.py:44
↓ 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:503
↓ 5 callersMethod__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:57
↓ 5 callersMethod__init__
( self, *, url: URL, )
src/anthropic/_base_client.py:148
↓ 5 callersFunction_api_status_error
(code: int)
tests/lib/tools/test_session_runner.py:121
↓ 5 callersFunction_emit
(event: str, payload: dict[str, Any])
src/anthropic/lib/middleware/_fallbacks.py:1468
↓ 5 callersFunction_is_base_client
True only for the base ``Anthropic`` / ``AsyncAnthropic`` classes, not subclasses. Subclasses (``AnthropicAWS``, ``AnthropicFoundry``) have their
src/anthropic/_client.py:56
↓ 5 callersFunction_is_status
(err: Exception, code: int)
src/anthropic/lib/environments/_poller.py:42
↓ 5 callersFunction_to_session_content
(content: Any)
tests/lib/tools/test_session_runner.py:1551
↓ 5 callersMethod_write_refresh_profile
(self, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:3328
↓ 5 callersFunctionaccumulate_event
( *, event: BetaRawMessageStreamEvent, current_snapshot: ParsedBetaMessage[ResponseFormatT] | None
src/anthropic/lib/streaming/_beta_messages.py:449
↓ 5 callersFunctionassert_different_identities
(obj1: object, obj2: object)
tests/test_files.py:55
↓ 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 callersFunctiondrive
()
tests/lib/tools/test_session_runner.py:551
↓ 5 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
↓ 5 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
↓ 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 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_api_status_error
(code: int)
tests/lib/environments/test_poller_method.py:36
↓ 4 callersFunction_assert_credential_chain_off
(client: AnthropicGoogleCloud | AsyncAnthropicGoogleCloud)
tests/lib/test_google_cloud.py:914
↓ 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_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:92
↓ 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_format_file_size
(bytes_size: int)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:363
↓ 4 callersMethod_get_http_client
Return an ``httpx.Client``, lazily creating (and tracking) one we own.
src/anthropic/lib/credentials/_providers.py:401
↓ 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_json_dumps
(value: Any)
src/anthropic/lib/middleware/_fallbacks.py:1446
↓ 4 callersMethod_load_config
Read and cache the config file, resolving ``base_url`` and ``credentials_path``.
src/anthropic/lib/credentials/_providers.py:278
↓ 4 callersFunction_mode
(p: Path)
tests/lib/tools/test_skills.py:119
↓ 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_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
↓ 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_within
True if ``child`` is ``root`` or a path inside it (both already resolved).
src/anthropic/lib/tools/_skills.py:35
↓ 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 callersMethodaiter_bytes
Given an iterator that yields raw binary data, iterate over it & yield every event encountered
src/anthropic/_streaming.py:449
↓ 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 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:546
↓ 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/_client.py:840
↓ 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 callersFunctioncreate_message_async
(client: AsyncAnthropic)
tests/lib/test_refusal_fallback.py:89
↓ 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 callersFunctionhelper_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:420
↓ 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:114
↓ 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 callersFunctioniter_next
(iter: Iterator[_T] | AsyncIterator[_T])
tests/decoders/test_jsonl.py:68
↓ 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 callersFunctionquote
Add single quotation marks around the given string. Does *not* do any escaping.
src/anthropic/_utils/_utils.py:221
↓ 4 callersFunctionupdate_env
(**new_env: str | Omit)
tests/utils.py:154
↓ 4 callersMethodworker
()
tests/lib/test_credentials.py:1527
↓ 3 callersMethod__init__
(self, *, cache_control: BetaCacheControlEphemeralParam | None = None)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:87
↓ 3 callersFunction_adrain_one
(ait: AsyncIterator[Any])
tests/lib/environments/test_poller_method.py:124
↓ 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:734
↓ 3 callersFunction_async_read_file_content
(full_path: AsyncPath, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:651
↓ 3 callersFunction_backoff
(attempt: int)
src/anthropic/lib/environments/_poller.py:30
↓ 3 callersFunction_config_dir
Resolve the config directory. ``ANTHROPIC_CONFIG_DIR`` env var → platform default. Platform defaults: * Linux & macOS: ``~/.config/ant
src/anthropic/lib/credentials/_constants.py:67
↓ 3 callersMethod_enforce_trailing_slash
(self, url: URL)
src/anthropic/_base_client.py:421
↓ 3 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
↓ 3 callersFunction_get_annotated_type
If the given type is an `Annotated` type then it is returned, if not `None` is returned. This also unwraps the type when applicable, e.g. `Requir
src/anthropic/_utils/_transform.py:116
↓ 3 callersMethod_get_page_items
(self)
src/anthropic/_base_client.py:211
↓ 3 callersFunction_is_fatal_4xx
(err: Exception)
src/anthropic/lib/environments/_poller.py:38
↓ 3 callersFunction_is_supported_image_type
(mime_type: str)
src/anthropic/lib/tools/mcp.py:86
↓ 3 callersFunction_jitter
(low: float, high: float)
src/anthropic/lib/environments/_poller.py:34
↓ 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, ``o
src/anthropic/lib/credentials/_secrets.py:95
↓ 3 callersMethod_make_status_error
( self, err_msg: str, *, body: object, response: httpx.Response, )
src/anthropic/_client.py:515
↓ 3 callersFunction_read_file_content
(full_path: Path, memory_path: str)
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:354
↓ 3 callersFunction_redact_body
Truncate a token-endpoint error body for safe inclusion in an exception.
src/anthropic/lib/credentials/_workload.py:57
↓ 3 callersMethod_request_api_list
( self, model: Type[object], page: Type[SyncPageT], options: FinalRequestOptio
src/anthropic/_base_client.py:1405
↓ 3 callersFunction_request_id
(resp: httpx.Response)
src/anthropic/lib/credentials/_workload.py:52
↓ 3 callersMethod_resolve_base_url
base_url precedence: top-level config field → bound (the owning client's base_url, via :meth:`bind_base_url`) → default. Validated aga
src/anthropic/lib/credentials/_providers.py:247
↓ 3 callersFunction_safe_json
(text: str)
src/anthropic/lib/middleware/_fallbacks.py:1439
↓ 3 callersFunction_seam_block
The synthetic `fallback` content block marking one model boundary.
src/anthropic/lib/middleware/_fallbacks.py:1368
↓ 3 callersMethod_should_retry
(self, response: httpx.Response)
src/anthropic/_base_client.py:842
↓ 3 callersMethod_signal
(self)
src/anthropic/lib/tools/_beta_session_runner.py:164
← previousnext →201–300 of 4,863, ranked by callers