MCPcopy Create free account

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

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

↓ 38 callersFunctiontexts
(content: Any)
tests/lib/tools/toolsets/_fakes.py:315
↓ 37 callersMethodresolve
Stage one of a call: the registry row for `name`, or the refusal the model reads (an unknown name, a member this application disabled, or one
src/anthropic/lib/tools/_toolsets/_base.py:213
↓ 37 callersFunctionstream_events
(*, index: object = 0)
tests/test_open_telemetry.py:588
↓ 37 callersMethodto_dict
(self)
tests/lib/tools/toolsets/_stubs.py:52
↓ 36 callersFunctionmessages_resource
(client: Any, *, beta: bool)
tests/test_open_telemetry.py:750
↓ 35 callersFunctionevents_of
What the stream yields, whether it is the sync or the async one.
tests/lib/tools/test_runner_eager_tools.py:1173
↓ 35 callersMethodget_token
Return a valid bearer token, refreshing if necessary.
src/anthropic/lib/credentials/_cache.py:179
↓ 35 callersFunctiontool_result
(tool_use_id: str, content: str = "Sunny in San Francisco")
tests/lib/threads/helpers.py:196
↓ 34 callersFunctioncreate_message
( client: Anthropic, *, betas: List[AnthropicBetaParam] | Omit = omit, fallbacks: List[BetaFal
tests/lib/test_refusal_fallback.py:82
↓ 33 callersFunctionbeta_read_tool
(ctx: AgentToolContext)
src/anthropic/lib/tools/agent_toolset.py:689
↓ 32 callersFunctionto_async_iter
Convert a synchronous iterator to an asynchronous one.
tests/lib/streaming/helpers.py:25
↓ 31 callersFunctioncall_client
What `invoke` returns for a client of `spans`: the synchronous one, or else the asynchronous one, awaited.
tests/test_open_telemetry.py:2904
↓ 31 callersFunctionfirst_reply
The timeline up to the second request, which is everything about the first reply.
tests/lib/tools/test_runner_eager_tools.py:868
↓ 31 callersFunctionmake_async_client
(**kwargs: Any)
tests/test_middleware.py:59
↓ 31 callersFunctionspan_id
(span: ReadableSpan | Span)
tests/lib/tools/test_open_telemetry.py:147
↓ 30 callersMethodappend_messages
Add one or more messages to the conversation history. This invalidates the cached tool response, i.e. if tools were already called, then they
src/anthropic/lib/tools/_beta_runner.py:338
↓ 30 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback.py:112
↓ 29 callersFunction_tool_use_response
(tool_name: str, tool_use_id: str, input: Union[Dict[str, Any], None] = None)
tests/lib/tools/test_runners.py:970
↓ 29 callersFunctionconstruct_type
Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned a
src/anthropic/_models.py:669
↓ 29 callersFunctionparent_id
(span: ReadableSpan)
tests/lib/tools/test_open_telemetry.py:153
↓ 29 callersFunctionrequest_bodies
(respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:165
↓ 29 callersFunctionstate_block
(content: Any)
tests/lib/tools/toolsets/_fakes.py:319
↓ 29 callersFunctionstream_response
A streamed reply. With `message_stop=False` the body ends after `message_delta`, as when the connection drops just before the last event.
tests/lib/threads/helpers.py:415
↓ 28 callersFunctioncall
Creates a Message with a synchronous or an asynchronous client.
tests/test_open_telemetry.py:3777
↓ 28 callersFunctiondefault_credentials
Resolve a `CredentialResult` from the environment per the credential-resolution spec. First match wins. Implements steps 2-5 of the spec prec
src/anthropic/lib/credentials/_chain.py:76
↓ 28 callersMethodopen
Resolve `root`; creates nothing — only `create_root` makes the folder.
src/anthropic/lib/tools/_file_store.py:100
↓ 28 callersFunctionprovider
()
tests/lib/test_google_cloud.py:435
↓ 27 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:770
↓ 27 callersMethodtool_result
Run one member `tool_use` and build its `tool_result` block, for callers driving `messages.create` themselves. Follows the tool runne
src/anthropic/lib/tools/_toolsets/_runnable.py:139
↓ 27 callersFunctionupdate_env
(**new_env: str | Omit)
tests/utils.py:165
↓ 26 callersFunctiondeepcopy_with_paths
Copy only the containers along the given paths. Used to guard against mutation by extract_files without copying the entire structure. Only di
src/anthropic/_files.py:144
↓ 26 callersFunctionrequests
(route: Any)
tests/test_open_telemetry.py:235
↓ 26 callersFunctiontool_use
(tool_use_id: str, name: str = "get_weather")
tests/lib/threads/helpers.py:189
↓ 25 callersFunctionextract_files
Recursively extract files from the given dictionary based on specified paths. A path may look like this ['foo', 'files', '<array>', 'data'].
src/anthropic/_utils/_utils.py:37
↓ 25 callersMethodroot
(self)
src/anthropic/lib/tools/_file_store.py:119
↓ 25 callersMethodstart
(self)
examples/memory/basic.py:50
↓ 25 callersMethodto_dict
(self)
tests/lib/test_stainless_helpers.py:24
↓ 25 callersFunctiontransform_schema
Transforms a JSON schema to ensure it conforms to the API's expectations. Args: json_schema (Dict[str, Any]): The original JSON sche
src/anthropic/lib/_parse/_transform.py:98
↓ 24 callersMethodadd_tools
Give the model more tools without changing the `tools` param, which would miss the prompt cache. The definitions are sent in `tool_addition`
src/anthropic/lib/tools/_beta_runner.py:469
↓ 24 callersMethodclose
(self)
tests/test_open_telemetry.py:646
↓ 24 callersMethodput
( self, path: str, *, cast_to: Type[ResponseT], body: Body | None = No
src/anthropic/_base_client.py:1708
↓ 23 callersFunction_requested_urls
(respx_mock: MockRouter)
tests/lib/test_google_cloud.py:1504
↓ 23 callersMethodcopy
( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] — narrows `credentials` to No
src/anthropic/lib/aws/_client.py:181
↓ 23 callersFunctionget_args
(t: type[Any])
src/anthropic/_compat.py:30
↓ 23 callersFunctioniter_work
Iterate work items claimed from a self-hosted environment. Each yielded `BetaSelfHostedWork` has already been ack'd. The `work` resource must
src/anthropic/lib/environments/_poller.py:84
↓ 23 callersFunctionmake_client
(client_cls: ClientClass, **kwargs: Any)
tests/test_header_case_sensitivity.py:29
↓ 23 callersFunctionmerge_headers
Compose header layers into a single layer: a plain mapping, as `default_headers=` and `extra_headers=` accept, that still carries an `Omit` for ev
src/anthropic/_base_client.py:2808
↓ 23 callersFunctionrequest_betas
(respx_mock: MockRouter)
tests/lib/threads/helpers.py:944
↓ 23 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:395
↓ 22 callersFunction_copy_client_with_bearer_auth
Return a copy of `client` authenticated with `auth_token` as Bearer. The returned sub-client inherits the parent's full configuration via `cl
src/anthropic/lib/_scoped_client.py:31
↓ 22 callersFunction_fake_client
(work: _FakeWorkResource, sessions: _FakeSessions)
tests/lib/environments/test_worker.py:153
↓ 22 callersFunction_send_message
(client: Anthropic)
tests/lib/test_credentials.py:2452
↓ 22 callersMethoddefer_tool_call
Hold a tool call of the current reply until you are done with the reply, which is when it runs without `run_tools_eagerly`: at the end of the
src/anthropic/lib/tools/_beta_runner.py:1012
↓ 22 callersMethodget_tracer
(self, *args: Any, **kwargs: Any)
tests/test_tracing.py:75
↓ 22 callersFunctionmake_async_runner
(*, stream: Literal[False] = False, **fields: Any)
tests/lib/threads/helpers.py:104
↓ 22 callersMethodretrieve_metadata
Get File Metadata Args: file_id: ID of the File. workspace_id: Optional header to select the Workspace for this
src/anthropic/resources/files.py:257
↓ 22 callersFunctionunsupported_response
(*unsupported: str)
tests/lib/threads/helpers.py:917
↓ 22 callersFunctionupdated
(path: str, content: str, *, was: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:77
↓ 22 callersMethodupload
Upload File Args: file: The file to upload. Only the final path component of the part's `filename` is kept;
src/anthropic/resources/files.py:316
↓ 21 callersFunction_mock_messages_endpoint
(respx_mock: MockRouter)
tests/lib/test_credentials.py:2411
↓ 21 callersFunctionbuild
(client: Anthropic | AsyncAnthropic, **options: Any)
tests/test_header_case_sensitivity.py:34
↓ 21 callersFunctionrun
( client: Anthropic, *, conversation_id: str | None = None, **kwargs: Any )
tests/lib/tools/test_open_telemetry.py:180
↓ 21 callersMethodthread
Start a message thread: a conversation the server holds between turns, so each request sends only the new messages. Takes the arguments of `cr
src/anthropic/resources/beta/messages/messages.py:1933
↓ 21 callersMethodwrite
(self, path: str, content: str)
tests/lib/tools/memory_sync/_fake_anthropic.py:61
↓ 20 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:159
↓ 20 callersMethodapprove
Approve a pending spend limit increase request. Writes a per-user spend limit at `amount` for the requester and transitions the
src/anthropic/resources/organization/spend_limits/increase_requests.py:154
↓ 20 callersMethoddeny
Deny a pending spend limit increase request. Idempotent on `denied`; denying an already-`approved` request returns 400. Anth
src/anthropic/resources/organization/spend_limits/increase_requests.py:219
↓ 20 callersMethoddownload
Download every attached store's memories to disk. `session` arrives already fetched — one snapshot shared with the skills download.
src/anthropic/lib/tools/_memories.py:282
↓ 20 callersFunctionget_directory_snapshot
Get a snapshot of directory contents with relative paths.
tests/lib/tools/memory_tools/test_filesystem.py:67
↓ 19 callersFunction_assert_not_in_sdk_frame_locals
(exc: BaseException, *secrets: str)
tests/lib/test_credentials.py:4861
↓ 19 callersFunction_send_message_async
(client: AsyncAnthropic)
tests/lib/test_credentials.py:3317
↓ 19 callersFunction_tool_confirmation
The user's allow/deny verdict for an ask-gated (`always_ask`) tool call.
tests/lib/tools/test_session_runner.py:100
↓ 19 callersMethodadd
Add Session Resource Args: file_id: ID of a previously uploaded file. mount_path: Mount path in the container.
src/anthropic/resources/beta/sessions/resources.py:351
↓ 19 callersFunctionfake_anthropic
An `AsyncAnthropic`-shaped client with one memory store named `notes`. The store lands at `{workdir}/memory/notes`. Returns the client to han
tests/lib/tools/memory_sync/_fake_anthropic.py:187
↓ 19 callersFunctionis_dict
(obj: object)
src/anthropic/_utils/_utils.py:194
↓ 19 callersFunctionmake_client
()
tests/lib/threads/helpers.py:54
↓ 19 callersMethodmodel_dump
Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump Generate a dictionary representation of the model, opti
src/anthropic/_models.py:368
↓ 19 callersFunctionrefusal
(browser: FakeBrowser, context: BetaToolsetCallContext, name: str, input: Any)
tests/lib/tools/toolsets/_fakes.py:324
↓ 19 callersFunctionsent_requests
(respx_mock: MockRouter)
tests/lib/threads/helpers.py:931
↓ 19 callersMethodview
View the contents of a memory path.
src/anthropic/lib/tools/_beta_builtin_memory_tool.py:136
↓ 18 callersFunction_requests
(respx_mock: MockRouter)
tests/lib/tools/toolsets/test_browser_runner.py:59
↓ 18 callersMethodcreate
Start an asynchronous job that uses past sessions to produce a reorganized version of a memory store and get back the dream to poll f
src/anthropic/resources/beta/dreams.py:51
↓ 18 callersMethodfork
A copy with the same history, request fields, tools and options that continues from no stored reply and has no turn in flight.
src/anthropic/lib/threads/_thread_state.py:156
↓ 18 callersMethodinvalidate
Clear the cached token so the next `get_token` re-invokes the provider. Also sets a one-shot `force_refresh` flag so on-disk providers skip
src/anthropic/lib/credentials/_cache.py:324
↓ 18 callersFunctionmcp_content
Convert a single MCP content block to an Anthropic content block. Handles text, image, and embedded resource content types. Raises `Unsupport
src/anthropic/lib/tools/mcp.py:119
↓ 18 callersFunctionresults_sent
The tool results the runner sent back for the first reply.
tests/lib/tools/test_runner_eager_tools.py:879
↓ 18 callersFunctionsettled
The result of a call on either runner: awaited on the async one.
tests/lib/tools/test_runner_eager_tools.py:1183
↓ 18 callersFunctionsse
`message` as the response of a streamed request.
tests/lib/tools/test_open_telemetry.py:87
↓ 18 callersMethodstart_as_current_span
(self, name: str, *args: Any, **kwargs: Any)
tests/test_tracing.py:64
↓ 17 callersMethod__anext__
(self)
src/anthropic/_streaming.py:186
↓ 17 callersFunction_end_turn
()
tests/lib/tools/toolsets/test_runner.py:60
↓ 17 callersFunction_idle_end_turn
()
tests/lib/tools/test_session_runner.py:127
↓ 17 callersFunctionbeta_grep_tool
Searches with the first `rg` on `PATH` that resolves to somewhere outside `workdir` and `allowed_roots`, or with a built-in search when there is n
src/anthropic/lib/tools/agent_toolset.py:861
↓ 17 callersFunctionerror_logs
Messages the middleware logged at ERROR — refusals surfaced rather than retried.
tests/lib/test_refusal_fallback_streaming.py:41
↓ 17 callersFunctionfake_session
An `EnvironmentWorker` pointed at a fake client; one work item queued.
tests/lib/tools/memory_sync/test_e2e_memory.py:41
↓ 17 callersFunctionresolve_auth_mode
Determine whether to use SigV4 auth. Returns True for SigV4, False for API key. Auth precedence: 1. api_key constructor arg → API key mode
src/anthropic/lib/aws/_credentials.py:31
↓ 17 callersFunctionresource_ids
The attributes of `span` that hold the ID of an API object.
tests/test_open_telemetry.py:6950
↓ 17 callersMethodretrieve
(self, memory_id: str, *, memory_store_id: str, **kwargs: Any)
tests/lib/tools/memory_sync/test_memory_sync.py:682
↓ 17 callersMethodsee
Adds a stream event to the timeline, as the caller saw it.
tests/lib/tools/test_runner_eager_tools.py:1084
↓ 17 callersFunctionsent_requests
(respx_mock: MockRouter)
tests/lib/test_bedrock_mantle.py:453
← previousnext →101–200 of 12,274, ranked by callers