MCPcopy Create free account

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

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

↓ 13 callersFunctionopenapi_dumps
Serialize an object to UTF-8 encoded JSON bytes. Extends the standard json.dumps with support for additional types commonly used in the
src/anthropic/_utils/_json.py:11
↓ 13 callersFunctionresolve_path
Resolve ``p`` against the workdir; reject results that escape it. Absolute and relative inputs go through the same canonicalise-then-contain
src/anthropic/lib/tools/agent_toolset.py:258
↓ 13 callersFunctionto_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 13 callersMethodview
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:134
↓ 12 callersFunction_get_params
(client: BaseClient[Any, Any])
tests/test_client.py:46
↓ 12 callersMethodack
(self, work_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:63
↓ 12 callersFunctionconstruct_type_unchecked
Loose coercion to the expected type with construction of nested values. Note: the returned value from this function is not guaranteed to match th
src/anthropic/_models.py:569
↓ 12 callersFunctionerror_logs
Messages the middleware logged at ERROR — refusals surfaced rather than retried.
tests/lib/test_refusal_fallback_streaming.py:37
↓ 12 callersFunctionget_auth_headers
( *, method: str, url: str, headers: httpx.Headers, aws_access_key: str | None, aws_se
src/anthropic/lib/aws/_auth.py:33
↓ 12 callersMethodheartbeat
( self, work_id: str, *, environment_id: str, expected_last_heartbeat:
tests/lib/environments/test_worker.py:42
↓ 12 callersMethodmcp_oauth_validate
Validate Credential Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers:
src/anthropic/resources/beta/vaults/credentials.py:414
↓ 12 callersMethodredact
Redact a memory version Args: betas: Optional header to specify the beta version(s) you want to use. extra_head
src/anthropic/resources/beta/memory_stores/memory_versions.py:210
↓ 12 callersFunctionresolve_api_key
Resolve the API key. Returns None if using SigV4.
src/anthropic/lib/aws/_credentials.py:65
↓ 11 callersFunction_emit
(event: str, payload: dict[str, Any])
src/anthropic/lib/middleware/_fallbacks.py:1468
↓ 11 callersFunction_get_weather
(location: str, units: Literal["c", "f"])
tests/lib/tools/test_runners.py:772
↓ 11 callersFunctionbody
()
tests/test_streaming.py:18
↓ 11 callersFunctionextract_response_type
Given a type like `APIResponse[T]`, returns the generic type variable `T`. This also handles the case where a concrete subclass is given, e.g.
src/anthropic/_response.py:860
↓ 11 callersFunctionget_args
(tp: type[Any])
src/anthropic/_utils/_compat.py:15
↓ 11 callersMethodrename
Rename or move a memory file or directory.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:159
↓ 11 callersFunctionrequest_body
(call: MockRequestCall)
tests/test_middleware.py:79
↓ 11 callersFunctionresolve_base_url
Resolve the base URL from constructor arg, env var, or region. Returns None if no base URL is resolvable (caller should raise).
src/anthropic/lib/aws/_credentials.py:108
↓ 11 callersFunctionresolve_region
Resolve the AWS region from constructor arg or env var. Does not silently default — returns None if no region is available.
src/anthropic/lib/aws/_credentials.py:82
↓ 11 callersMethodsend
(self, session_id: str, *, events: list[Any], extra_headers: Any = None)
tests/lib/tools/test_session_runner.py:202
↓ 11 callersFunctiontag_helper
Mark an object as created by a named SDK helper.
src/anthropic/lib/_stainless_helpers.py:84
↓ 10 callersMethod__class__
(self)
src/anthropic/_utils/_proxy.py:48
↓ 10 callersFunction_mock_client
Return a mock that quacks like ClientSession.call_tool.
tests/lib/tools/test_mcp_tool.py:56
↓ 10 callersFunction_validate_output_config_conflict
( output_config: BetaOutputConfigParam | Omit, output_format: object, )
src/anthropic/resources/beta/messages/messages.py:4186
↓ 10 callersFunction_warn_output_format_deprecated
Emit deprecation warning if output_format is provided.
src/anthropic/resources/beta/messages/messages.py:4210
↓ 10 callersMethodaclose
(self)
src/anthropic/lib/middleware/_fallbacks.py:1563
↓ 10 callersFunctionbeta_edit_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:548
↓ 10 callersFunctionbeta_read_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:491
↓ 10 callersMethodclose
(self)
src/anthropic/lib/tools/agent_toolset.py:414
↓ 10 callersMethodcreate_enrollment_url
Create Enrollment URL Args: betas: Optional header to specify the beta version(s) you want to use. extra_header
src/anthropic/resources/beta/user_profiles.py:306
↓ 10 callersMethodextra_headers
Return headers derived from the config file (e.g. ``workspace_id``). Eagerly reads the config if not yet loaded. The returned dict is
src/anthropic/lib/credentials/_providers.py:251
↓ 10 callersFunctionget_origin
(t: type[Any])
src/anthropic/_compat.py:36
↓ 10 callersFunctionget_origin
(tp: type[Any])
src/anthropic/_utils/_compat.py:19
↓ 10 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
↓ 10 callersFunctionmake_event_iterator
( content: Iterator[bytes], *, sync: bool, client: Anthropic, async_client: AsyncAnthropic
tests/test_streaming.py:266
↓ 10 callersMethodpause
Pause Deployment Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers: Se
src/anthropic/resources/beta/deployments.py:425
↓ 10 callersMethodpoll
(self, environment_id: str, **kwargs: Any)
tests/lib/environments/test_poller_method.py:54
↓ 10 callersFunctionresolve_workspace_id
Resolve the workspace ID from constructor arg or env var(s). Returns None if no workspace ID is available (caller should raise).
src/anthropic/lib/aws/_credentials.py:93
↓ 10 callersMethodresults
Streams the results of a Message Batch as a `.jsonl` file. Each line in the file is a JSON object containing the result of a single
src/anthropic/resources/messages/batches.py:285
↓ 10 callersMethodretrieve_metadata
Get File Metadata Args: file_id: ID of the File. betas: Optional header to specify the beta version(s) you want
src/anthropic/resources/beta/files.py:237
↓ 10 callersMethodstats
Get statistics about the work queue for an environment. Args: betas: Optional header to specify the beta version(s) you wa
src/anthropic/resources/beta/environments/work.py:466
↓ 10 callersMethodunpause
Unpause Deployment Args: betas: Optional header to specify the beta version(s) you want to use. extra_headers:
src/anthropic/resources/beta/deployments.py:519
↓ 10 callersMethoduntil_done
Blocks until the stream has been consumed
src/anthropic/lib/streaming/_messages.py:118
↓ 10 callersMethodupload
Upload File Args: file: The file to upload betas: Optional header to specify the beta version(s) you want to us
src/anthropic/resources/beta/files.py:286
↓ 9 callersFunction_fake_client
(work: _FakeWorkResource, sessions: _FakeSessions)
tests/lib/environments/test_worker.py:84
↓ 9 callersFunctionaccumulate_managed_agents_event
( accumulated: AccumulatedEvent | None, event: BetaManagedAgentsAgentMessageEvent, )
src/anthropic/lib/sessions/_accumulate.py:22
↓ 9 callersFunctionaiter_work
Async version of :func:`iter_work`. See its docstring for semantics, including how ``extra_headers`` is passed through per request.
src/anthropic/lib/environments/_poller.py:189
↓ 9 callersFunctionassert_different_identities
(obj1: object, obj2: object)
tests/test_files.py:55
↓ 9 callersFunctionassert_empty_iter
(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent])
tests/test_streaming.py:261
↓ 9 callersMethodexec
(self, cmd: str, timeout: float = BASH_DEFAULT_TIMEOUT)
src/anthropic/lib/tools/agent_toolset.py:338
↓ 9 callersFunctionmessage_start
()
tests/lib/test_refusal_fallback_streaming.py:110
↓ 9 callersFunctionmiddleware_request_body
(request: APIRequest)
tests/test_middleware.py:83
↓ 9 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:97
↓ 9 callersFunctionseed
(event_id: str)
tests/lib/sessions/test_accumulate.py:28
↓ 9 callersMethodstr_replace
Replace text in a memory file.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:144
↓ 9 callersMethodto_dict
(self)
src/anthropic/lib/tools/_beta_functions.py:183
↓ 8 callersMethod__anext__
(self)
src/anthropic/_streaming.py:235
↓ 8 callersFunction_archive_top_dir
Return the single top-level directory shared by every archive entry, or ``""`` if the entries don't all live under one common directory. Skil
src/anthropic/lib/tools/_skills.py:61
↓ 8 callersFunction_blob_resource
(uri: str = "file:///x.bin", blob: str = "", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:48
↓ 8 callersMethod_calculate_nonstreaming_timeout
(self, max_tokens: int, max_nonstreaming_tokens: int | None)
src/anthropic/_base_client.py:769
↓ 8 callersFunction_merge_output_configs
( output_config: BetaOutputConfigParam | Omit, output_format: Optional[BetaJSONOutputFormatParam] | Om
src/anthropic/resources/beta/messages/messages.py:4198
↓ 8 callersFunction_middleware_name
(middleware: object)
src/anthropic/_middleware.py:66
↓ 8 callersFunction_mode
(p: Path)
tests/lib/tools/test_skills.py:119
↓ 8 callersMethod_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:387
↓ 8 callersFunctionaccumulate_event
( *, event: BetaRawMessageStreamEvent, current_snapshot: ParsedBetaMessage[ResponseFormatT] | None
src/anthropic/lib/streaming/_beta_messages.py:449
↓ 8 callersMethodbind_base_url
Set the API ``base_url`` the token exchange POSTs to. Called by :class:`anthropic.Anthropic` when this object is passed as ``credenti
src/anthropic/lib/credentials/_workload.py:193
↓ 8 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:184
↓ 8 callersMethodcopy
Create a new client instance re-using the same options given to the current client with optional overriding.
src/anthropic/lib/vertex/_client.py:348
↓ 8 callersFunctionerror_body
(*, type: str, message: str)
tests/test_middleware.py:75
↓ 8 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_response.py:307
↓ 8 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_response.py:416
↓ 8 callersMethodparse
( self, *, max_tokens: int, messages: Iterable[MessageParam], model: M
src/anthropic/resources/messages/messages.py:1202
↓ 8 callersFunctionrefusal_delta
(token: str | None = "tok_abc", has_prefill_claim: bool = True)
tests/lib/test_refusal_fallback_streaming.py:128
↓ 7 callersMethod_auth_block
Return the cached ``authentication`` sub-object from the config file.
src/anthropic/lib/credentials/_providers.py:445
↓ 7 callersMethod_ensure_memory_root
Ensure the memory root directory exists
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:669
↓ 7 callersFunction_extract_skill_archive
Extract a skill download (a zip or tar.* archive) from disk into ``dest``. Skill bundles are wrapped in a single directory named after the skill;
src/anthropic/lib/tools/_skills.py:108
↓ 7 callersFunction_install_scoped_client
Intercept the shared bearer-auth client factory. Returns the list of args the factory was called with so a test can assert on the helper-tele
tests/lib/environments/test_worker.py:90
↓ 7 callersFunction_jitter
(low: float, high: float)
src/anthropic/lib/environments/_poller.py:34
↓ 7 callersMethod_make_client
(self)
tests/lib/test_bedrock_mantle.py:120
↓ 7 callersFunction_passthrough_sse
Forward a decoded event in its original wire bytes, preserving SSE fields beyond `event:`/`data:` (`id:`, `retry:`, comment lines). Falls back to
src/anthropic/lib/middleware/_fallbacks.py:1472
↓ 7 callersFunction_read_result
(contents: list[Any])
tests/lib/tools/test_mcp_tool.py:52
↓ 7 callersFunction_send_message_async
(client: AsyncAnthropic)
tests/lib/test_credentials.py:2565
↓ 7 callersFunction_strip_top
Drop the leading ``top`` component from ``safe`` (an already-confined relative path). Returns ``""`` for the bare top-dir entry itself.
src/anthropic/lib/tools/_skills.py:82
↓ 7 callersFunction_text_resource
(uri: str = "file:///x.txt", text: str = "hello", mime: str | None = None)
tests/lib/tools/test_mcp_tool.py:44
↓ 7 callersMethod_validate_path
Validate and resolve memory paths
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:673
↓ 7 callersFunctionbeta_agent_toolset_20260401
Return the ``agent_toolset_20260401`` implementations bound to ``ctx``. The result is a plain list of :class:`~anthropic.lib.tools.BetaAsyncFunct
src/anthropic/lib/tools/agent_toolset.py:730
↓ 7 callersFunctionbeta_headers
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:102
↓ 7 callersMethodbind_base_url
Adopt the owning client's ``base_url`` as a fallback for the token exchange. Slots between the config file's own ``base_url`` field and
src/anthropic/lib/credentials/_providers.py:220
↓ 7 callersFunctionblock_starts
(events: list[BetaRawMessageStreamEvent])
tests/lib/test_refusal_fallback_streaming.py:189
↓ 7 callersFunctionfill
(target: Dict[str, Any], key: str, env_var: str)
src/anthropic/lib/credentials/_providers.py:85
↓ 7 callersFunctionmodel_dump
( model: pydantic.BaseModel, *, exclude: IncEx | None = None, exclude_unset: bool = False,
src/anthropic/_compat.py:144
↓ 7 callersMethodparse
(self, *, to: type[_T])
src/anthropic/_legacy_response.py:97
↓ 7 callersMethodrequest
( self, cast_to: Type[ResponseT], options: FinalRequestOptions, *, str
src/anthropic/_base_client.py:1083
↓ 7 callersFunctionvalidate_credentials
Raise if only one of aws_access_key/aws_secret_key is provided.
src/anthropic/lib/aws/_credentials.py:7
↓ 6 callersMethod__get_proxied__
(self)
src/anthropic/_utils/_proxy.py:57
↓ 6 callersFunction_api_status_error
(code: int)
tests/lib/environments/test_poller_method.py:36
↓ 6 callersFunction_api_status_error
(code: int)
tests/lib/tools/test_session_runner.py:108
← previousnext →101–200 of 4,447, ranked by callers