Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
12,824 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,824
◇
Types & classes
4,274
↳
Endpoints
47
Function
test_asks_confirm_before_a_call_runs_while_the_reply_streams
(setup: SetupFactory, family: str)
tests/lib/tools/test_runner_eager_toolsets.py:123
Method
test_assigned_base_url_takes_every_route
(self, respx_mock: MockRouter)
tests/lib/test_google_cloud.py:1611
Method
test_assistant_message
(self)
tests/lib/tools/test_mcp_tool.py:187
Method
test_async_401_for_a_request_with_its_own_credential_keeps_the_cached_token
(self, header: str)
tests/lib/test_credentials.py:3789
Method
test_async_401_invalidates_and_retries_once
Async client 401 behavior mirrors sync: invalidate the cache and retry the current request once with a freshly minted token.
tests/lib/test_credentials.py:3690
Method
test_async_401_refreshes_on_the_next_call_when_max_retries_is_zero
(self)
tests/lib/test_credentials.py:3772
Method
test_async_401_refreshes_when_authorization_was_changed_on_the_request
Async mirror of the sync test.
tests/lib/test_credentials.py:3760
Method
test_async_aclose_via_context_manager
`async with AsyncAnthropic(...)` exits cleanly and cascades close.
tests/lib/test_credentials.py:3819
Method
test_async_api_key_mode_sends_foundry_key_as_x_api_key
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_azure.py:284
Method
test_async_authorized_user_refresh_flow
Async client calling a CredentialsFile(authorized_user) provider: the blocking refresh_token POST runs on the worker thread via asyncify.
tests/lib/test_credentials.py:3644
Function
test_async_aws_client_in_api_key_mode_sends_only_the_bearer
()
tests/lib/test_scoped_client.py:252
Method
test_async_azure_ad_token_provider
Test async client with async Azure AD token provider.
tests/lib/test_azure.py:138
Method
test_async_base_url_from_region
(self)
tests/lib/test_bedrock_mantle.py:353
Method
test_async_batch_create_starts_its_span_with_the_request_count
( self, beta: bool, respx_mock: MockRouter )
tests/test_open_telemetry.py:2695
Method
test_async_batch_results_span_covers_the_download
(self, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:1140
Method
test_async_batches_keep_the_header
( self, send: AsyncSendBatch, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:797
Method
test_async_batches_send_no_header_when_no_profile_is_set
( self, send: AsyncSendBatch, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:823
Method
test_async_batches_send_the_client_default_header_unless_the_request_names_one
( self, send: AsyncSendBatch, user_profile_id: str | Omit, sent: str,
tests/lib/test_bedrock_mantle.py:861
Method
test_async_bedrock_middleware_sees_canonical_request
(self, respx_mock: MockRouter)
tests/test_middleware.py:1974
Function
test_async_call_from_inside_a_member_is_a_contract_error_and_cancellation_releases_the_lock
()
tests/lib/tools/toolsets/test_pipeline.py:1114
Method
test_async_call_reads_the_platform_off_the_event_loop
( self, spans: Spans, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch )
tests/test_open_telemetry.py:2404
Method
test_async_callable_object_handles_requests
(self, respx_mock: MockRouter)
tests/test_middleware.py:534
Method
test_async_caller_api_key_header_wins_case_insensitively
(self)
tests/lib/test_azure.py:335
Method
test_async_caller_authorization_header_wins_case_insensitively
(self)
tests/lib/test_azure.py:321
Function
test_async_calls_run_one_at_a_time
()
tests/lib/tools/toolsets/test_pipeline.py:1331
Function
test_async_calls_run_one_at_a_time_and_close_waits
()
tests/lib/tools/toolsets/test_computer_pipeline.py:515
Method
test_async_client_accepts_async_callable_object
(self)
tests/test_middleware.py:528
Method
test_async_client_has_same_restrictions
(self)
tests/lib/test_bedrock_mantle.py:338
Function
test_async_client_path_clears_api_key_and_sets_bearer
The same invariants hold for `AsyncAnthropic` — verifies the `ClientT` typevar threads sync/async correctly through `copy()`.
tests/lib/test_scoped_client.py:77
Method
test_async_client_rejects_non_callable
(self)
tests/test_middleware.py:578
Method
test_async_client_rejects_sync_callable_object
(self)
tests/test_middleware.py:549
Method
test_async_client_rejects_sync_handle_async_override
(self)
tests/test_middleware.py:586
Method
test_async_client_workspace_id_is_kept
( self, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:895
Function
test_async_close_and_async_with_mark_the_toolset_closed_async
()
tests/lib/tools/toolsets/test_runner.py:728
Method
test_async_close_cascades_to_credentials
AsyncAnthropic.close() cascades to self.credentials.close().
tests/lib/test_credentials.py:3802
Function
test_async_close_from_inside_a_member_does_not_wait_for_itself
()
tests/lib/tools/toolsets/test_pipeline.py:1266
Function
test_async_close_waits_for_accepted_calls_to_settle
()
tests/lib/tools/toolsets/test_pipeline.py:1226
Method
test_async_concurrent_requests_single_flight
Concurrent async requests sharing a TokenCache cause at most one provider call — the single-flight guarantee holds across async workers.
tests/lib/test_credentials.py:3671
Function
test_async_confirm_may_be_a_coroutine_or_a_plain_function
()
tests/lib/tools/toolsets/test_computer_pipeline.py:395
Function
test_async_confirm_may_be_a_coroutine_or_a_plain_function
()
tests/lib/tools/toolsets/test_confirm.py:250
Method
test_async_context_manager_requires_input_schema
(self)
tests/lib/tools/test_functions.py:551
Method
test_async_context_manager_tool_lazy_enter_and_cleanup
(self)
tests/lib/tools/test_functions.py:496
Method
test_async_copy_parity
(self)
tests/lib/test_google_cloud.py:1045
Method
test_async_copy_with_different_base_url_exchanges_per_client
Async mirror of the sync test: `copy(base_url=...)` leaves the parent exchanging at, and presenting tokens from, its own host.
tests/lib/test_credentials.py:3615
Method
test_async_copy_with_same_base_url_shares_token_exchange
(self, respx_mock: MockRouter)
tests/lib/test_credentials.py:3630
Function
test_async_copy_x_stainless_helper_header_appends
()
tests/lib/test_bedrock.py:732
Method
test_async_copy_x_stainless_helper_header_appends
(self)
tests/lib/test_bedrock_mantle.py:413
Function
test_async_count_tokens_accepts_a_type
(async_client: AsyncAnthropic, respx_mock: MockRouter)
tests/lib/test_output_format_helpers.py:92
Function
test_async_count_tokens_rejects_a_schema_dict
(async_client: AsyncAnthropic)
tests/lib/test_output_format_helpers.py:104
Method
test_async_create
( self, message: dict[str, Any], content_mode: str, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:7783
Method
test_async_disabled_spans_leave_the_body_of_the_response_alone
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:2461
Method
test_async_dropped_stream
(self, spans: Spans, caplog: pytest.LogCaptureFixture, reads: int)
tests/test_open_telemetry.py:1661
Method
test_async_each_kind_of_page
(self, call: ResourceList, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:7700
Method
test_async_each_resource
(self, call: ResourceCall, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:7659
Method
test_async_elapsed_of_a_response_whose_body_ends_the_span
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:1630
Method
test_async_event_stream_ended_by_the_server
( self, spans: Spans, respx_mock: MockRouter, raw: bool )
tests/test_open_telemetry.py:2315
Method
test_async_events_read_after_the_response_was_closed_leave_the_span_alone
( self, spans: Spans, respx_mock: MockRouter, caplog: pytest.LogCaptureFixture )
tests/test_open_telemetry.py:1497
Function
test_async_execute_awaits_async_members_and_a_sync_one_is_a_contract_error
()
tests/lib/tools/toolsets/test_interface.py:254
Function
test_async_execute_awaits_async_members_and_a_sync_one_is_a_contract_error
()
tests/lib/tools/toolsets/test_computer_interface.py:168
Function
test_async_execute_dispatches_to_the_member_method_and_refuses_unknown_names
()
tests/lib/tools/toolsets/test_interface.py:337
Function
test_async_file_without_a_name_is_sent_unnamed
()
tests/test_files.py:95
Function
test_async_has_all_resources
()
tests/lib/test_aws.py:407
Method
test_async_ids_in_the_path
(self, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:7342
Function
test_async_keeps_the_host_and_headers_of_the_parents_credential
( tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch )
tests/lib/test_scoped_client.py:198
Method
test_async_late_401_for_replaced_token_does_not_refresh_again
Async mirror of the sync test.
tests/lib/test_credentials.py:3707
Method
test_async_late_401_forces_refresh_for_per_request_tokens
Async mirror of the sync test.
tests/lib/test_credentials.py:3734
Method
test_async_lib_clients_copy_inherits_replaces_and_clears
(self)
tests/test_middleware.py:2134
Method
test_async_mantle_middleware_sees_canonical_request
(self, respx_mock: MockRouter)
tests/test_middleware.py:2053
Method
test_async_matches_the_first_party_client
(self)
tests/lib/test_bedrock_mantle.py:265
Method
test_async_max_retries_zero_honored_on_401
max_retries=0 means a 401 surfaces immediately — no implicit retry.
tests/lib/test_credentials.py:3837
Method
test_async_mcp_tool_to_dict
(self)
tests/lib/tools/test_mcp_tool.py:327
Method
test_async_no_x_api_key_with_azure_ad_token_provider
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_azure.py:269
Method
test_async_parse_converts_pydantic
Verify async .parse() converts Pydantic models to output_config.format.
tests/api_resources/beta/test_output_format_conversion.py:321
Function
test_async_pathlib_in_file_tuple
()
tests/test_files.py:56
Function
test_async_pathlib_includes_file_name
()
tests/test_files.py:27
Method
test_async_per_request_omit_keeps_the_client_default
( self, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter )
tests/lib/test_bedrock_mantle.py:932
Function
test_async_pipeline_parity
()
tests/lib/tools/toolsets/test_pipeline.py:1058
Method
test_async_raw_response_ends_the_span_with_its_body
( self, spans: Spans, respx_mock: MockRouter, caplog: pytest.LogCaptureFixture )
tests/test_open_telemetry.py:1208
Method
test_async_raw_response_whose_body_is_not_read_to_the_end_has_no_status
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:1252
Method
test_async_raw_response_whose_connection_is_lost_in_the_body
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:1602
Method
test_async_raw_response_whose_events_the_application_reads_itself
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:1547
Method
test_async_request_body_that_cannot_be_prepared_has_no_span
( self, spans: Spans, tmp_path: pathlib.Path )
tests/test_open_telemetry.py:1016
Function
test_async_response_basemodel_request_id
(client: Anthropic)
tests/test_response.py:181
Function
test_async_response_parse_annotated_type
(async_client: AsyncAnthropic)
tests/test_response.py:219
Function
test_async_response_parse_bool
(client: AsyncAnthropic, content: str, expected: bool)
tests/test_response.py:272
Function
test_async_response_parse_custom_model
(async_client: AsyncAnthropic)
tests/test_response.py:144
Function
test_async_response_parse_custom_stream
(async_client: AsyncAnthropic)
tests/test_response.py:109
Function
test_async_response_parse_expect_model_union_non_json_content
(async_client: AsyncAnthropic)
tests/test_response.py:308
Function
test_async_response_parse_json_content_type_case_insensitive
(async_client: AsyncAnthropic)
tests/test_response.py:374
Function
test_async_response_parse_mismatched_basemodel
(async_client: AsyncAnthropic)
tests/test_response.py:77
Function
test_async_response_parse_pep604_union
(async_client: AsyncAnthropic)
tests/test_response.py:339
Method
test_async_runner
(self, spans: Spans, respx_mock: MockRouter)
tests/lib/tools/test_open_telemetry.py:1834
Method
test_async_runners_that_are_open_when_the_event_loop_ends_have_no_status
( self, spans: Spans, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch )
tests/lib/tools/test_open_telemetry.py:1381
Method
test_async_sampling_fields_that_the_sdk_does_not_model_have_no_attribute
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:964
Method
test_async_sent_in_body_instead_of_header
( self, send: AsyncSendMessage, async_client: AsyncAnthropicBedrockMantle, respx_mock: MockRouter
tests/lib/test_bedrock_mantle.py:706
Method
test_async_session_create_has_its_agent_model_and_environment
( self, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:7525
Method
test_async_static_token
(self, respx_mock: MockRouter)
tests/lib/test_credentials.py:3586
Method
test_async_stop_sequences
(self, beta: bool, spans: Spans, respx_mock: MockRouter)
tests/test_open_telemetry.py:6725
Method
test_async_stop_sequences_alone_over_the_bound_are_removed_whole
( self, over: bool, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:6832
Method
test_async_stream_and_parse_helpers_have_the_route
( self, beta: bool, spans: Spans, respx_mock: MockRouter )
tests/test_open_telemetry.py:3118
← previous
next →
5,601–5,700 of 12,824, ranked by callers