diff options
| author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
|---|---|---|
| committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
| commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
| tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/anthropic/types | |
| parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
| download | gn-ai-master.tar.gz | |
Diffstat (limited to '.venv/lib/python3.12/site-packages/anthropic/types')
194 files changed, 5231 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/__init__.py b/.venv/lib/python3.12/site-packages/anthropic/types/__init__.py new file mode 100644 index 00000000..94196102 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/__init__.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .model import Model as Model +from .usage import Usage as Usage +from .shared import ( + ErrorObject as ErrorObject, + BillingError as BillingError, + ErrorResponse as ErrorResponse, + NotFoundError as NotFoundError, + APIErrorObject as APIErrorObject, + RateLimitError as RateLimitError, + OverloadedError as OverloadedError, + PermissionError as PermissionError, + AuthenticationError as AuthenticationError, + GatewayTimeoutError as GatewayTimeoutError, + InvalidRequestError as InvalidRequestError, +) +from .message import Message as Message +from .beta_error import BetaError as BetaError +from .completion import Completion as Completion +from .model_info import ModelInfo as ModelInfo +from .text_block import TextBlock as TextBlock +from .text_delta import TextDelta as TextDelta +from .tool_param import ToolParam as ToolParam +from .model_param import ModelParam as ModelParam +from .content_block import ContentBlock as ContentBlock +from .message_param import MessageParam as MessageParam +from .text_citation import TextCitation as TextCitation +from .beta_api_error import BetaAPIError as BetaAPIError +from .metadata_param import MetadataParam as MetadataParam +from .thinking_block import ThinkingBlock as ThinkingBlock +from .thinking_delta import ThinkingDelta as ThinkingDelta +from .tool_use_block import ToolUseBlock as ToolUseBlock +from .citations_delta import CitationsDelta as CitationsDelta +from .signature_delta import SignatureDelta as SignatureDelta +from .input_json_delta import InputJSONDelta as InputJSONDelta +from .text_block_param import TextBlockParam as TextBlockParam +from .tool_union_param import ToolUnionParam as ToolUnionParam +from .image_block_param import ImageBlockParam as ImageBlockParam +from .model_list_params import ModelListParams as ModelListParams +from .tool_choice_param import ToolChoiceParam as ToolChoiceParam +from .beta_billing_error import BetaBillingError as BetaBillingError +from .message_stop_event import MessageStopEvent as MessageStopEvent +from .beta_error_response import BetaErrorResponse as BetaErrorResponse +from .content_block_param import ContentBlockParam as ContentBlockParam +from .message_delta_event import MessageDeltaEvent as MessageDeltaEvent +from .message_delta_usage import MessageDeltaUsage as MessageDeltaUsage +from .message_start_event import MessageStartEvent as MessageStartEvent +from .text_citation_param import TextCitationParam as TextCitationParam +from .anthropic_beta_param import AnthropicBetaParam as AnthropicBetaParam +from .beta_not_found_error import BetaNotFoundError as BetaNotFoundError +from .document_block_param import DocumentBlockParam as DocumentBlockParam +from .message_stream_event import MessageStreamEvent as MessageStreamEvent +from .message_tokens_count import MessageTokensCount as MessageTokensCount +from .thinking_block_param import ThinkingBlockParam as ThinkingBlockParam +from .tool_use_block_param import ToolUseBlockParam as ToolUseBlockParam +from .url_pdf_source_param import URLPDFSourceParam as URLPDFSourceParam +from .beta_overloaded_error import BetaOverloadedError as BetaOverloadedError +from .beta_permission_error import BetaPermissionError as BetaPermissionError +from .beta_rate_limit_error import BetaRateLimitError as BetaRateLimitError +from .message_create_params import MessageCreateParams as MessageCreateParams +from .thinking_config_param import ThinkingConfigParam as ThinkingConfigParam +from .tool_choice_any_param import ToolChoiceAnyParam as ToolChoiceAnyParam +from .citation_char_location import CitationCharLocation as CitationCharLocation +from .citation_page_location import CitationPageLocation as CitationPageLocation +from .citations_config_param import CitationsConfigParam as CitationsConfigParam +from .raw_message_stop_event import RawMessageStopEvent as RawMessageStopEvent +from .tool_choice_auto_param import ToolChoiceAutoParam as ToolChoiceAutoParam +from .tool_choice_none_param import ToolChoiceNoneParam as ToolChoiceNoneParam +from .tool_choice_tool_param import ToolChoiceToolParam as ToolChoiceToolParam +from .url_image_source_param import URLImageSourceParam as URLImageSourceParam +from .base64_pdf_source_param import Base64PDFSourceParam as Base64PDFSourceParam +from .plain_text_source_param import PlainTextSourceParam as PlainTextSourceParam +from .raw_message_delta_event import RawMessageDeltaEvent as RawMessageDeltaEvent +from .raw_message_start_event import RawMessageStartEvent as RawMessageStartEvent +from .redacted_thinking_block import RedactedThinkingBlock as RedactedThinkingBlock +from .tool_result_block_param import ToolResultBlockParam as ToolResultBlockParam +from .completion_create_params import CompletionCreateParams as CompletionCreateParams +from .content_block_stop_event import ContentBlockStopEvent as ContentBlockStopEvent +from .raw_message_stream_event import RawMessageStreamEvent as RawMessageStreamEvent +from .tool_bash_20250124_param import ToolBash20250124Param as ToolBash20250124Param +from .base64_image_source_param import Base64ImageSourceParam as Base64ImageSourceParam +from .beta_authentication_error import BetaAuthenticationError as BetaAuthenticationError +from .content_block_delta_event import ContentBlockDeltaEvent as ContentBlockDeltaEvent +from .content_block_start_event import ContentBlockStartEvent as ContentBlockStartEvent +from .beta_gateway_timeout_error import BetaGatewayTimeoutError as BetaGatewayTimeoutError +from .beta_invalid_request_error import BetaInvalidRequestError as BetaInvalidRequestError +from .content_block_source_param import ContentBlockSourceParam as ContentBlockSourceParam +from .message_count_tokens_params import MessageCountTokensParams as MessageCountTokensParams +from .citation_char_location_param import CitationCharLocationParam as CitationCharLocationParam +from .citation_page_location_param import CitationPageLocationParam as CitationPageLocationParam +from .raw_content_block_stop_event import RawContentBlockStopEvent as RawContentBlockStopEvent +from .cache_control_ephemeral_param import CacheControlEphemeralParam as CacheControlEphemeralParam +from .raw_content_block_delta_event import RawContentBlockDeltaEvent as RawContentBlockDeltaEvent +from .raw_content_block_start_event import RawContentBlockStartEvent as RawContentBlockStartEvent +from .redacted_thinking_block_param import RedactedThinkingBlockParam as RedactedThinkingBlockParam +from .thinking_config_enabled_param import ThinkingConfigEnabledParam as ThinkingConfigEnabledParam +from .thinking_config_disabled_param import ThinkingConfigDisabledParam as ThinkingConfigDisabledParam +from .citation_content_block_location import CitationContentBlockLocation as CitationContentBlockLocation +from .message_count_tokens_tool_param import MessageCountTokensToolParam as MessageCountTokensToolParam +from .tool_text_editor_20250124_param import ToolTextEditor20250124Param as ToolTextEditor20250124Param +from .content_block_source_content_param import ContentBlockSourceContentParam as ContentBlockSourceContentParam +from .citation_content_block_location_param import ( + CitationContentBlockLocationParam as CitationContentBlockLocationParam, +) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/anthropic_beta_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/anthropic_beta_param.py new file mode 100644 index 00000000..ff5fdffd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/anthropic_beta_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, TypeAlias + +__all__ = ["AnthropicBetaParam"] + +AnthropicBetaParam: TypeAlias = Union[ + str, + Literal[ + "message-batches-2024-09-24", + "prompt-caching-2024-07-31", + "computer-use-2024-10-22", + "computer-use-2025-01-24", + "pdfs-2024-09-25", + "token-counting-2024-11-01", + "token-efficient-tools-2025-02-19", + "output-128k-2025-02-19", + ], +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/base64_image_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/base64_image_source_param.py new file mode 100644 index 00000000..93fdb9d1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/base64_image_source_param.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._types import Base64FileInput +from .._utils import PropertyInfo +from .._models import set_pydantic_config + +__all__ = ["Base64ImageSourceParam"] + + +class Base64ImageSourceParam(TypedDict, total=False): + data: Required[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] + + media_type: Required[Literal["image/jpeg", "image/png", "image/gif", "image/webp"]] + + type: Required[Literal["base64"]] + + +set_pydantic_config(Base64ImageSourceParam, {"arbitrary_types_allowed": True}) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/base64_pdf_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/base64_pdf_source_param.py new file mode 100644 index 00000000..ac247a19 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/base64_pdf_source_param.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._types import Base64FileInput +from .._utils import PropertyInfo +from .._models import set_pydantic_config + +__all__ = ["Base64PDFSourceParam"] + + +class Base64PDFSourceParam(TypedDict, total=False): + data: Required[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] + + media_type: Required[Literal["application/pdf"]] + + type: Required[Literal["base64"]] + + +set_pydantic_config(Base64PDFSourceParam, {"arbitrary_types_allowed": True}) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/__init__.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/__init__.py new file mode 100644 index 00000000..916b0ab6 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/__init__.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .beta_usage import BetaUsage as BetaUsage +from .beta_message import BetaMessage as BetaMessage +from .beta_model_info import BetaModelInfo as BetaModelInfo +from .beta_text_block import BetaTextBlock as BetaTextBlock +from .beta_text_delta import BetaTextDelta as BetaTextDelta +from .beta_tool_param import BetaToolParam as BetaToolParam +from .model_list_params import ModelListParams as ModelListParams +from .beta_content_block import BetaContentBlock as BetaContentBlock +from .beta_message_param import BetaMessageParam as BetaMessageParam +from .beta_text_citation import BetaTextCitation as BetaTextCitation +from .beta_metadata_param import BetaMetadataParam as BetaMetadataParam +from .beta_thinking_block import BetaThinkingBlock as BetaThinkingBlock +from .beta_thinking_delta import BetaThinkingDelta as BetaThinkingDelta +from .beta_tool_use_block import BetaToolUseBlock as BetaToolUseBlock +from .beta_citations_delta import BetaCitationsDelta as BetaCitationsDelta +from .beta_signature_delta import BetaSignatureDelta as BetaSignatureDelta +from .beta_input_json_delta import BetaInputJSONDelta as BetaInputJSONDelta +from .beta_text_block_param import BetaTextBlockParam as BetaTextBlockParam +from .beta_tool_union_param import BetaToolUnionParam as BetaToolUnionParam +from .message_create_params import MessageCreateParams as MessageCreateParams +from .beta_image_block_param import BetaImageBlockParam as BetaImageBlockParam +from .beta_tool_choice_param import BetaToolChoiceParam as BetaToolChoiceParam +from .beta_content_block_param import BetaContentBlockParam as BetaContentBlockParam +from .beta_message_delta_usage import BetaMessageDeltaUsage as BetaMessageDeltaUsage +from .beta_text_citation_param import BetaTextCitationParam as BetaTextCitationParam +from .beta_message_tokens_count import BetaMessageTokensCount as BetaMessageTokensCount +from .beta_thinking_block_param import BetaThinkingBlockParam as BetaThinkingBlockParam +from .beta_tool_use_block_param import BetaToolUseBlockParam as BetaToolUseBlockParam +from .beta_url_pdf_source_param import BetaURLPDFSourceParam as BetaURLPDFSourceParam +from .beta_thinking_config_param import BetaThinkingConfigParam as BetaThinkingConfigParam +from .beta_tool_choice_any_param import BetaToolChoiceAnyParam as BetaToolChoiceAnyParam +from .beta_base64_pdf_block_param import BetaBase64PDFBlockParam as BetaBase64PDFBlockParam +from .beta_citation_char_location import BetaCitationCharLocation as BetaCitationCharLocation +from .beta_citation_page_location import BetaCitationPageLocation as BetaCitationPageLocation +from .beta_citations_config_param import BetaCitationsConfigParam as BetaCitationsConfigParam +from .beta_raw_message_stop_event import BetaRawMessageStopEvent as BetaRawMessageStopEvent +from .beta_tool_choice_auto_param import BetaToolChoiceAutoParam as BetaToolChoiceAutoParam +from .beta_tool_choice_none_param import BetaToolChoiceNoneParam as BetaToolChoiceNoneParam +from .beta_tool_choice_tool_param import BetaToolChoiceToolParam as BetaToolChoiceToolParam +from .beta_url_image_source_param import BetaURLImageSourceParam as BetaURLImageSourceParam +from .message_count_tokens_params import MessageCountTokensParams as MessageCountTokensParams +from .beta_base64_pdf_source_param import BetaBase64PDFSourceParam as BetaBase64PDFSourceParam +from .beta_plain_text_source_param import BetaPlainTextSourceParam as BetaPlainTextSourceParam +from .beta_raw_message_delta_event import BetaRawMessageDeltaEvent as BetaRawMessageDeltaEvent +from .beta_raw_message_start_event import BetaRawMessageStartEvent as BetaRawMessageStartEvent +from .beta_redacted_thinking_block import BetaRedactedThinkingBlock as BetaRedactedThinkingBlock +from .beta_tool_result_block_param import BetaToolResultBlockParam as BetaToolResultBlockParam +from .beta_raw_message_stream_event import BetaRawMessageStreamEvent as BetaRawMessageStreamEvent +from .beta_tool_bash_20241022_param import BetaToolBash20241022Param as BetaToolBash20241022Param +from .beta_tool_bash_20250124_param import BetaToolBash20250124Param as BetaToolBash20250124Param +from .beta_base64_image_source_param import BetaBase64ImageSourceParam as BetaBase64ImageSourceParam +from .beta_content_block_source_param import BetaContentBlockSourceParam as BetaContentBlockSourceParam +from .beta_citation_char_location_param import BetaCitationCharLocationParam as BetaCitationCharLocationParam +from .beta_citation_page_location_param import BetaCitationPageLocationParam as BetaCitationPageLocationParam +from .beta_raw_content_block_stop_event import BetaRawContentBlockStopEvent as BetaRawContentBlockStopEvent +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam as BetaCacheControlEphemeralParam +from .beta_raw_content_block_delta_event import BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent +from .beta_raw_content_block_start_event import BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent +from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam +from .beta_thinking_config_enabled_param import BetaThinkingConfigEnabledParam as BetaThinkingConfigEnabledParam +from .beta_thinking_config_disabled_param import BetaThinkingConfigDisabledParam as BetaThinkingConfigDisabledParam +from .beta_citation_content_block_location import BetaCitationContentBlockLocation as BetaCitationContentBlockLocation +from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param as BetaToolTextEditor20241022Param +from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param as BetaToolTextEditor20250124Param +from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param as BetaToolComputerUse20241022Param +from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param as BetaToolComputerUse20250124Param +from .beta_content_block_source_content_param import ( + BetaContentBlockSourceContentParam as BetaContentBlockSourceContentParam, +) +from .beta_citation_content_block_location_param import ( + BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam, +) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_image_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_image_source_param.py new file mode 100644 index 00000000..8f13ce38 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_image_source_param.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import Base64FileInput +from ..._utils import PropertyInfo +from ..._models import set_pydantic_config + +__all__ = ["BetaBase64ImageSourceParam"] + + +class BetaBase64ImageSourceParam(TypedDict, total=False): + data: Required[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] + + media_type: Required[Literal["image/jpeg", "image/png", "image/gif", "image/webp"]] + + type: Required[Literal["base64"]] + + +set_pydantic_config(BetaBase64ImageSourceParam, {"arbitrary_types_allowed": True}) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_block_param.py new file mode 100644 index 00000000..16f51a9d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_block_param.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .beta_url_pdf_source_param import BetaURLPDFSourceParam +from .beta_citations_config_param import BetaCitationsConfigParam +from .beta_base64_pdf_source_param import BetaBase64PDFSourceParam +from .beta_plain_text_source_param import BetaPlainTextSourceParam +from .beta_content_block_source_param import BetaContentBlockSourceParam +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaBase64PDFBlockParam", "Source"] + +Source: TypeAlias = Union[ + BetaBase64PDFSourceParam, BetaPlainTextSourceParam, BetaContentBlockSourceParam, BetaURLPDFSourceParam +] + + +class BetaBase64PDFBlockParam(TypedDict, total=False): + source: Required[Source] + + type: Required[Literal["document"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] + + citations: BetaCitationsConfigParam + + context: Optional[str] + + title: Optional[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_source_param.py new file mode 100644 index 00000000..1137c957 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_base64_pdf_source_param.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import Base64FileInput +from ..._utils import PropertyInfo +from ..._models import set_pydantic_config + +__all__ = ["BetaBase64PDFSourceParam"] + + +class BetaBase64PDFSourceParam(TypedDict, total=False): + data: Required[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] + + media_type: Required[Literal["application/pdf"]] + + type: Required[Literal["base64"]] + + +set_pydantic_config(BetaBase64PDFSourceParam, {"arbitrary_types_allowed": True}) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_cache_control_ephemeral_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_cache_control_ephemeral_param.py new file mode 100644 index 00000000..540d769d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_cache_control_ephemeral_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaCacheControlEphemeralParam"] + + +class BetaCacheControlEphemeralParam(TypedDict, total=False): + type: Required[Literal["ephemeral"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location.py new file mode 100644 index 00000000..2109949a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaCitationCharLocation"] + + +class BetaCitationCharLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_char_index: int + + start_char_index: int + + type: Literal["char_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location_param.py new file mode 100644 index 00000000..8c09f5a7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_char_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaCitationCharLocationParam"] + + +class BetaCitationCharLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_char_index: Required[int] + + start_char_index: Required[int] + + type: Required[Literal["char_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location.py new file mode 100644 index 00000000..8fde76f9 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaCitationContentBlockLocation"] + + +class BetaCitationContentBlockLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_block_index: int + + start_block_index: int + + type: Literal["content_block_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location_param.py new file mode 100644 index 00000000..9e378a78 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_content_block_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaCitationContentBlockLocationParam"] + + +class BetaCitationContentBlockLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_block_index: Required[int] + + start_block_index: Required[int] + + type: Required[Literal["content_block_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location.py new file mode 100644 index 00000000..9e6f60dd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaCitationPageLocation"] + + +class BetaCitationPageLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_page_number: int + + start_page_number: int + + type: Literal["page_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location_param.py new file mode 100644 index 00000000..60e5b1c2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citation_page_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaCitationPageLocationParam"] + + +class BetaCitationPageLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_page_number: Required[int] + + start_page_number: Required[int] + + type: Required[Literal["page_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_config_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_config_param.py new file mode 100644 index 00000000..409cfde7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_config_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BetaCitationsConfigParam"] + + +class BetaCitationsConfigParam(TypedDict, total=False): + enabled: bool diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_delta.py new file mode 100644 index 00000000..2c6c02b2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_citations_delta.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel +from .beta_citation_char_location import BetaCitationCharLocation +from .beta_citation_page_location import BetaCitationPageLocation +from .beta_citation_content_block_location import BetaCitationContentBlockLocation + +__all__ = ["BetaCitationsDelta", "Citation"] + +Citation: TypeAlias = Annotated[ + Union[BetaCitationCharLocation, BetaCitationPageLocation, BetaCitationContentBlockLocation], + PropertyInfo(discriminator="type"), +] + + +class BetaCitationsDelta(BaseModel): + citation: Citation + + type: Literal["citations_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block.py new file mode 100644 index 00000000..7cf9736e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ..._utils import PropertyInfo +from .beta_text_block import BetaTextBlock +from .beta_thinking_block import BetaThinkingBlock +from .beta_tool_use_block import BetaToolUseBlock +from .beta_redacted_thinking_block import BetaRedactedThinkingBlock + +__all__ = ["BetaContentBlock"] + +BetaContentBlock: TypeAlias = Annotated[ + Union[BetaTextBlock, BetaToolUseBlock, BetaThinkingBlock, BetaRedactedThinkingBlock], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_param.py new file mode 100644 index 00000000..1768f321 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_text_block_param import BetaTextBlockParam +from .beta_image_block_param import BetaImageBlockParam +from .beta_thinking_block_param import BetaThinkingBlockParam +from .beta_tool_use_block_param import BetaToolUseBlockParam +from .beta_base64_pdf_block_param import BetaBase64PDFBlockParam +from .beta_tool_result_block_param import BetaToolResultBlockParam +from .beta_redacted_thinking_block_param import BetaRedactedThinkingBlockParam + +__all__ = ["BetaContentBlockParam"] + +BetaContentBlockParam: TypeAlias = Union[ + BetaTextBlockParam, + BetaImageBlockParam, + BetaToolUseBlockParam, + BetaToolResultBlockParam, + BetaBase64PDFBlockParam, + BetaThinkingBlockParam, + BetaRedactedThinkingBlockParam, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_content_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_content_param.py new file mode 100644 index 00000000..bc13b146 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_content_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_text_block_param import BetaTextBlockParam +from .beta_image_block_param import BetaImageBlockParam + +__all__ = ["BetaContentBlockSourceContentParam"] + +BetaContentBlockSourceContentParam: TypeAlias = Union[BetaTextBlockParam, BetaImageBlockParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_param.py new file mode 100644 index 00000000..512cf0db --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_content_block_source_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .beta_content_block_source_content_param import BetaContentBlockSourceContentParam + +__all__ = ["BetaContentBlockSourceParam"] + + +class BetaContentBlockSourceParam(TypedDict, total=False): + content: Required[Union[str, Iterable[BetaContentBlockSourceContentParam]]] + + type: Required[Literal["content"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_image_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_image_block_param.py new file mode 100644 index 00000000..ddb9d4c0 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_image_block_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .beta_url_image_source_param import BetaURLImageSourceParam +from .beta_base64_image_source_param import BetaBase64ImageSourceParam +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaImageBlockParam", "Source"] + +Source: TypeAlias = Union[BetaBase64ImageSourceParam, BetaURLImageSourceParam] + + +class BetaImageBlockParam(TypedDict, total=False): + source: Required[Source] + + type: Required[Literal["image"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_input_json_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_input_json_delta.py new file mode 100644 index 00000000..a5f9cbea --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_input_json_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaInputJSONDelta"] + + +class BetaInputJSONDelta(BaseModel): + partial_json: str + + type: Literal["input_json_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message.py new file mode 100644 index 00000000..a4d6cdec --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..model import Model +from ..._models import BaseModel +from .beta_usage import BetaUsage +from .beta_content_block import BetaContentBlock, BetaContentBlock as BetaContentBlock + +__all__ = ["BetaMessage"] + + +class BetaMessage(BaseModel): + id: str + """Unique object identifier. + + The format and length of IDs may change over time. + """ + + content: List[BetaContentBlock] + """Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines + its shape. + + Example: + + ```json + [{ "type": "text", "text": "Hi, I'm Claude." }] + ``` + + If the request input `messages` ended with an `assistant` turn, then the + response `content` will continue directly from that last turn. You can use this + to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Then the response `content` might be: + + ```json + [{ "type": "text", "text": "B)" }] + ``` + """ + + model: Model + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + role: Literal["assistant"] + """Conversational role of the generated message. + + This will always be `"assistant"`. + """ + + stop_reason: Optional[Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]] = None + """The reason that we stopped. + + This may be one the following values: + + - `"end_turn"`: the model reached a natural stopping point + - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + - `"tool_use"`: the model invoked one or more tools + + In non-streaming mode this value is always non-null. In streaming mode, it is + null in the `message_start` event and non-null otherwise. + """ + + stop_sequence: Optional[str] = None + """Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was + generated. + """ + + type: Literal["message"] + """Object type. + + For Messages, this is always `"message"`. + """ + + usage: BetaUsage + """Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the + underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the + model. The model's output then goes through a parsing stage before becoming an + API response. As a result, the token counts in `usage` will not match one-to-one + with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response + from Claude. + + Total input tokens in a request is the summation of `input_tokens`, + `cache_creation_input_tokens`, and `cache_read_input_tokens`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_delta_usage.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_delta_usage.py new file mode 100644 index 00000000..cc681911 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_delta_usage.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["BetaMessageDeltaUsage"] + + +class BetaMessageDeltaUsage(BaseModel): + output_tokens: int + """The cumulative number of output tokens which were used.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_param.py new file mode 100644 index 00000000..b41e56d3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .beta_content_block_param import BetaContentBlockParam + +__all__ = ["BetaMessageParam"] + + +class BetaMessageParam(TypedDict, total=False): + content: Required[Union[str, Iterable[BetaContentBlockParam]]] + + role: Required[Literal["user", "assistant"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_tokens_count.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_tokens_count.py new file mode 100644 index 00000000..e11daee7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_message_tokens_count.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["BetaMessageTokensCount"] + + +class BetaMessageTokensCount(BaseModel): + input_tokens: int + """ + The total number of tokens across the provided list of messages, system prompt, + and tools. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_metadata_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_metadata_param.py new file mode 100644 index 00000000..8ccda216 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_metadata_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["BetaMetadataParam"] + + +class BetaMetadataParam(TypedDict, total=False): + user_id: Optional[str] + """An external identifier for the user who is associated with the request. + + This should be a uuid, hash value, or other opaque identifier. Anthropic may use + this id to help detect abuse. Do not include any identifying information such as + name, email address, or phone number. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_model_info.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_model_info.py new file mode 100644 index 00000000..6ea50d9f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_model_info.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaModelInfo"] + + +class BetaModelInfo(BaseModel): + id: str + """Unique model identifier.""" + + created_at: datetime + """RFC 3339 datetime string representing the time at which the model was released. + + May be set to an epoch value if the release date is unknown. + """ + + display_name: str + """A human-readable name for the model.""" + + type: Literal["model"] + """Object type. + + For Models, this is always `"model"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_plain_text_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_plain_text_source_param.py new file mode 100644 index 00000000..187a2386 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_plain_text_source_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaPlainTextSourceParam"] + + +class BetaPlainTextSourceParam(TypedDict, total=False): + data: Required[str] + + media_type: Required[Literal["text/plain"]] + + type: Required[Literal["text"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_delta_event.py new file mode 100644 index 00000000..cd50f289 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_delta_event.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel +from .beta_text_delta import BetaTextDelta +from .beta_thinking_delta import BetaThinkingDelta +from .beta_citations_delta import BetaCitationsDelta +from .beta_signature_delta import BetaSignatureDelta +from .beta_input_json_delta import BetaInputJSONDelta + +__all__ = ["BetaRawContentBlockDeltaEvent", "Delta"] + +Delta: TypeAlias = Annotated[ + Union[BetaTextDelta, BetaInputJSONDelta, BetaCitationsDelta, BetaThinkingDelta, BetaSignatureDelta], + PropertyInfo(discriminator="type"), +] + + +class BetaRawContentBlockDeltaEvent(BaseModel): + delta: Delta + + index: int + + type: Literal["content_block_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_start_event.py new file mode 100644 index 00000000..086c216c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_start_event.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel +from .beta_text_block import BetaTextBlock +from .beta_thinking_block import BetaThinkingBlock +from .beta_tool_use_block import BetaToolUseBlock +from .beta_redacted_thinking_block import BetaRedactedThinkingBlock + +__all__ = ["BetaRawContentBlockStartEvent", "ContentBlock"] + +ContentBlock: TypeAlias = Annotated[ + Union[BetaTextBlock, BetaToolUseBlock, BetaThinkingBlock, BetaRedactedThinkingBlock], + PropertyInfo(discriminator="type"), +] + + +class BetaRawContentBlockStartEvent(BaseModel): + content_block: ContentBlock + + index: int + + type: Literal["content_block_start"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_stop_event.py new file mode 100644 index 00000000..d8551860 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_content_block_stop_event.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaRawContentBlockStopEvent"] + + +class BetaRawContentBlockStopEvent(BaseModel): + index: int + + type: Literal["content_block_stop"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_delta_event.py new file mode 100644 index 00000000..525fd10c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_delta_event.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from .beta_message_delta_usage import BetaMessageDeltaUsage + +__all__ = ["BetaRawMessageDeltaEvent", "Delta"] + + +class Delta(BaseModel): + stop_reason: Optional[Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]] = None + + stop_sequence: Optional[str] = None + + +class BetaRawMessageDeltaEvent(BaseModel): + delta: Delta + + type: Literal["message_delta"] + + usage: BetaMessageDeltaUsage + """Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the + underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the + model. The model's output then goes through a parsing stage before becoming an + API response. As a result, the token counts in `usage` will not match one-to-one + with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response + from Claude. + + Total input tokens in a request is the summation of `input_tokens`, + `cache_creation_input_tokens`, and `cache_read_input_tokens`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_start_event.py new file mode 100644 index 00000000..9bb16f94 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_start_event.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel +from .beta_message import BetaMessage + +__all__ = ["BetaRawMessageStartEvent"] + + +class BetaRawMessageStartEvent(BaseModel): + message: BetaMessage + + type: Literal["message_start"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stop_event.py new file mode 100644 index 00000000..dff33cde --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stop_event.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaRawMessageStopEvent"] + + +class BetaRawMessageStopEvent(BaseModel): + type: Literal["message_stop"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stream_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stream_event.py new file mode 100644 index 00000000..00ffd7c1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_raw_message_stream_event.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ..._utils import PropertyInfo +from .beta_raw_message_stop_event import BetaRawMessageStopEvent +from .beta_raw_message_delta_event import BetaRawMessageDeltaEvent +from .beta_raw_message_start_event import BetaRawMessageStartEvent +from .beta_raw_content_block_stop_event import BetaRawContentBlockStopEvent +from .beta_raw_content_block_delta_event import BetaRawContentBlockDeltaEvent +from .beta_raw_content_block_start_event import BetaRawContentBlockStartEvent + +__all__ = ["BetaRawMessageStreamEvent"] + +BetaRawMessageStreamEvent: TypeAlias = Annotated[ + Union[ + BetaRawMessageStartEvent, + BetaRawMessageDeltaEvent, + BetaRawMessageStopEvent, + BetaRawContentBlockStartEvent, + BetaRawContentBlockDeltaEvent, + BetaRawContentBlockStopEvent, + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block.py new file mode 100644 index 00000000..b27bd933 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaRedactedThinkingBlock"] + + +class BetaRedactedThinkingBlock(BaseModel): + data: str + + type: Literal["redacted_thinking"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block_param.py new file mode 100644 index 00000000..cc7d870f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_redacted_thinking_block_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaRedactedThinkingBlockParam"] + + +class BetaRedactedThinkingBlockParam(TypedDict, total=False): + data: Required[str] + + type: Required[Literal["redacted_thinking"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_signature_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_signature_delta.py new file mode 100644 index 00000000..a3586826 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_signature_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaSignatureDelta"] + + +class BetaSignatureDelta(BaseModel): + signature: str + + type: Literal["signature_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block.py new file mode 100644 index 00000000..f6374b41 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from .beta_text_citation import BetaTextCitation + +__all__ = ["BetaTextBlock"] + + +class BetaTextBlock(BaseModel): + citations: Optional[List[BetaTextCitation]] = None + """Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. + Citing a PDF results in `page_location`, plain text results in `char_location`, + and content document results in `content_block_location`. + """ + + text: str + + type: Literal["text"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block_param.py new file mode 100644 index 00000000..e40b03a5 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_block_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_text_citation_param import BetaTextCitationParam +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaTextBlockParam"] + + +class BetaTextBlockParam(TypedDict, total=False): + text: Required[str] + + type: Required[Literal["text"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] + + citations: Optional[Iterable[BetaTextCitationParam]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation.py new file mode 100644 index 00000000..538878b6 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ..._utils import PropertyInfo +from .beta_citation_char_location import BetaCitationCharLocation +from .beta_citation_page_location import BetaCitationPageLocation +from .beta_citation_content_block_location import BetaCitationContentBlockLocation + +__all__ = ["BetaTextCitation"] + +BetaTextCitation: TypeAlias = Annotated[ + Union[BetaCitationCharLocation, BetaCitationPageLocation, BetaCitationContentBlockLocation], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation_param.py new file mode 100644 index 00000000..b04c3305 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_citation_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_citation_char_location_param import BetaCitationCharLocationParam +from .beta_citation_page_location_param import BetaCitationPageLocationParam +from .beta_citation_content_block_location_param import BetaCitationContentBlockLocationParam + +__all__ = ["BetaTextCitationParam"] + +BetaTextCitationParam: TypeAlias = Union[ + BetaCitationCharLocationParam, BetaCitationPageLocationParam, BetaCitationContentBlockLocationParam +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_delta.py new file mode 100644 index 00000000..b94ba5ea --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_text_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaTextDelta"] + + +class BetaTextDelta(BaseModel): + text: str + + type: Literal["text_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block.py new file mode 100644 index 00000000..9a9c1df8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaThinkingBlock"] + + +class BetaThinkingBlock(BaseModel): + signature: str + + thinking: str + + type: Literal["thinking"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block_param.py new file mode 100644 index 00000000..5bd43180 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_block_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaThinkingBlockParam"] + + +class BetaThinkingBlockParam(TypedDict, total=False): + signature: Required[str] + + thinking: Required[str] + + type: Required[Literal["thinking"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_disabled_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_disabled_param.py new file mode 100644 index 00000000..e7c4a2a0 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_disabled_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaThinkingConfigDisabledParam"] + + +class BetaThinkingConfigDisabledParam(TypedDict, total=False): + type: Required[Literal["disabled"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_enabled_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_enabled_param.py new file mode 100644 index 00000000..f9490c4c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_enabled_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaThinkingConfigEnabledParam"] + + +class BetaThinkingConfigEnabledParam(TypedDict, total=False): + budget_tokens: Required[int] + """Determines how many tokens Claude can use for its internal reasoning process. + + Larger budgets can enable more thorough analysis for complex problems, improving + response quality. + + Must be ≥1024 and less than `max_tokens`. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + type: Required[Literal["enabled"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_param.py new file mode 100644 index 00000000..47494239 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_config_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_thinking_config_enabled_param import BetaThinkingConfigEnabledParam +from .beta_thinking_config_disabled_param import BetaThinkingConfigDisabledParam + +__all__ = ["BetaThinkingConfigParam"] + +BetaThinkingConfigParam: TypeAlias = Union[BetaThinkingConfigEnabledParam, BetaThinkingConfigDisabledParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_delta.py new file mode 100644 index 00000000..790a304e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_thinking_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaThinkingDelta"] + + +class BetaThinkingDelta(BaseModel): + thinking: str + + type: Literal["thinking_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20241022_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20241022_param.py new file mode 100644 index 00000000..82ed02b3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20241022_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolBash20241022Param"] + + +class BetaToolBash20241022Param(TypedDict, total=False): + name: Required[Literal["bash"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["bash_20241022"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20250124_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20250124_param.py new file mode 100644 index 00000000..3fcab440 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_bash_20250124_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolBash20250124Param"] + + +class BetaToolBash20250124Param(TypedDict, total=False): + name: Required[Literal["bash"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["bash_20250124"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_any_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_any_param.py new file mode 100644 index 00000000..6cdac00a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_any_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaToolChoiceAnyParam"] + + +class BetaToolChoiceAnyParam(TypedDict, total=False): + type: Required[Literal["any"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_auto_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_auto_param.py new file mode 100644 index 00000000..e2f20572 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_auto_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaToolChoiceAutoParam"] + + +class BetaToolChoiceAutoParam(TypedDict, total=False): + type: Required[Literal["auto"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_none_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_none_param.py new file mode 100644 index 00000000..3a0951a4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_none_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaToolChoiceNoneParam"] + + +class BetaToolChoiceNoneParam(TypedDict, total=False): + type: Required[Literal["none"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_param.py new file mode 100644 index 00000000..ff6a51aa --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_param.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_tool_choice_any_param import BetaToolChoiceAnyParam +from .beta_tool_choice_auto_param import BetaToolChoiceAutoParam +from .beta_tool_choice_none_param import BetaToolChoiceNoneParam +from .beta_tool_choice_tool_param import BetaToolChoiceToolParam + +__all__ = ["BetaToolChoiceParam"] + +BetaToolChoiceParam: TypeAlias = Union[ + BetaToolChoiceAutoParam, BetaToolChoiceAnyParam, BetaToolChoiceToolParam, BetaToolChoiceNoneParam +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_tool_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_tool_param.py new file mode 100644 index 00000000..e826237a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_choice_tool_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaToolChoiceToolParam"] + + +class BetaToolChoiceToolParam(TypedDict, total=False): + name: Required[str] + """The name of the tool to use.""" + + type: Required[Literal["tool"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20241022_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20241022_param.py new file mode 100644 index 00000000..b95472be --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20241022_param.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolComputerUse20241022Param"] + + +class BetaToolComputerUse20241022Param(TypedDict, total=False): + display_height_px: Required[int] + """The height of the display in pixels.""" + + display_width_px: Required[int] + """The width of the display in pixels.""" + + name: Required[Literal["computer"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["computer_20241022"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] + + display_number: Optional[int] + """The X11 display number (e.g. 0, 1) for the display.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20250124_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20250124_param.py new file mode 100644 index 00000000..089d67aa --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_computer_use_20250124_param.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolComputerUse20250124Param"] + + +class BetaToolComputerUse20250124Param(TypedDict, total=False): + display_height_px: Required[int] + """The height of the display in pixels.""" + + display_width_px: Required[int] + """The width of the display in pixels.""" + + name: Required[Literal["computer"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["computer_20250124"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] + + display_number: Optional[int] + """The X11 display number (e.g. 0, 1) for the display.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_param.py new file mode 100644 index 00000000..da9d43bc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_param.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolParam", "InputSchema"] + + +class InputSchemaTyped(TypedDict, total=False): + type: Required[Literal["object"]] + + properties: Optional[object] + + +InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]] + + +class BetaToolParam(TypedDict, total=False): + input_schema: Required[InputSchema] + """[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model + will produce. + """ + + name: Required[str] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + cache_control: Optional[BetaCacheControlEphemeralParam] + + description: str + """Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that + the model has about what the tool is and how to use it, the better it will + perform. You can use natural language descriptions to reinforce important + aspects of the tool input JSON schema. + """ + + type: Optional[Literal["custom"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_result_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_result_block_param.py new file mode 100644 index 00000000..9418b650 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_result_block_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .beta_text_block_param import BetaTextBlockParam +from .beta_image_block_param import BetaImageBlockParam +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolResultBlockParam", "Content"] + +Content: TypeAlias = Union[BetaTextBlockParam, BetaImageBlockParam] + + +class BetaToolResultBlockParam(TypedDict, total=False): + tool_use_id: Required[str] + + type: Required[Literal["tool_result"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] + + content: Union[str, Iterable[Content]] + + is_error: bool diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20241022_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20241022_param.py new file mode 100644 index 00000000..86c93278 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20241022_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolTextEditor20241022Param"] + + +class BetaToolTextEditor20241022Param(TypedDict, total=False): + name: Required[Literal["str_replace_editor"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["text_editor_20241022"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20250124_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20250124_param.py new file mode 100644 index 00000000..07b86bd5 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_text_editor_20250124_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolTextEditor20250124Param"] + + +class BetaToolTextEditor20250124Param(TypedDict, total=False): + name: Required[Literal["str_replace_editor"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["text_editor_20250124"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_union_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_union_param.py new file mode 100644 index 00000000..d37480da --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_union_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .beta_tool_param import BetaToolParam +from .beta_tool_bash_20241022_param import BetaToolBash20241022Param +from .beta_tool_bash_20250124_param import BetaToolBash20250124Param +from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param +from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param +from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param +from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param + +__all__ = ["BetaToolUnionParam"] + +BetaToolUnionParam: TypeAlias = Union[ + BetaToolParam, + BetaToolComputerUse20241022Param, + BetaToolBash20241022Param, + BetaToolTextEditor20241022Param, + BetaToolComputerUse20250124Param, + BetaToolBash20250124Param, + BetaToolTextEditor20250124Param, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block.py new file mode 100644 index 00000000..7cfc0c33 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BetaToolUseBlock"] + + +class BetaToolUseBlock(BaseModel): + id: str + + input: object + + name: str + + type: Literal["tool_use"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block_param.py new file mode 100644 index 00000000..603dc85f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_tool_use_block_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .beta_cache_control_ephemeral_param import BetaCacheControlEphemeralParam + +__all__ = ["BetaToolUseBlockParam"] + + +class BetaToolUseBlockParam(TypedDict, total=False): + id: Required[str] + + input: Required[object] + + name: Required[str] + + type: Required[Literal["tool_use"]] + + cache_control: Optional[BetaCacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_image_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_image_source_param.py new file mode 100644 index 00000000..a094a433 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_image_source_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaURLImageSourceParam"] + + +class BetaURLImageSourceParam(TypedDict, total=False): + type: Required[Literal["url"]] + + url: Required[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_pdf_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_pdf_source_param.py new file mode 100644 index 00000000..acc1eabf --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_url_pdf_source_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BetaURLPDFSourceParam"] + + +class BetaURLPDFSourceParam(TypedDict, total=False): + type: Required[Literal["url"]] + + url: Required[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_usage.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_usage.py new file mode 100644 index 00000000..0d956c70 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/beta_usage.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["BetaUsage"] + + +class BetaUsage(BaseModel): + cache_creation_input_tokens: Optional[int] = None + """The number of input tokens used to create the cache entry.""" + + cache_read_input_tokens: Optional[int] = None + """The number of input tokens read from the cache.""" + + input_tokens: int + """The number of input tokens which were used.""" + + output_tokens: int + """The number of output tokens which were used.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_count_tokens_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_count_tokens_params.py new file mode 100644 index 00000000..056c4289 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_count_tokens_params.py @@ -0,0 +1,234 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from typing_extensions import Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo +from ..model_param import ModelParam +from .beta_tool_param import BetaToolParam +from .beta_message_param import BetaMessageParam +from ..anthropic_beta_param import AnthropicBetaParam +from .beta_text_block_param import BetaTextBlockParam +from .beta_tool_choice_param import BetaToolChoiceParam +from .beta_thinking_config_param import BetaThinkingConfigParam +from .beta_tool_bash_20241022_param import BetaToolBash20241022Param +from .beta_tool_bash_20250124_param import BetaToolBash20250124Param +from .beta_tool_text_editor_20241022_param import BetaToolTextEditor20241022Param +from .beta_tool_text_editor_20250124_param import BetaToolTextEditor20250124Param +from .beta_tool_computer_use_20241022_param import BetaToolComputerUse20241022Param +from .beta_tool_computer_use_20250124_param import BetaToolComputerUse20250124Param + +__all__ = ["MessageCountTokensParams", "Tool"] + + +class MessageCountTokensParams(TypedDict, total=False): + messages: Required[Iterable[BetaMessageParam]] + """Input messages. + + Our models are trained to operate on alternating `user` and `assistant` + conversational turns. When creating a new `Message`, you specify the prior + conversational turns with the `messages` parameter, and the model then generates + the next `Message` in the conversation. Consecutive `user` or `assistant` turns + in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can + specify a single `user`-role message, or you can include multiple `user` and + `assistant` messages. + + If the final message uses the `assistant` role, the response content will + continue immediately from the content in that message. This can be used to + constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{ "role": "user", "content": "Hello, Claude" }] + ``` + + Example with multiple conversational turns: + + ```json + [ + { "role": "user", "content": "Hello there." }, + { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, + { "role": "user", "content": "Can you explain LLMs in plain English?" } + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Each input message `content` may be either a single `string` or an array of + content blocks, where each block has a specific `type`. Using a `string` for + `content` is shorthand for an array of one content block of type `"text"`. The + following input messages are equivalent: + + ```json + { "role": "user", "content": "Hello, Claude" } + ``` + + ```json + { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } + ``` + + Starting with Claude 3 models, you can also send image content blocks: + + ```json + { + "role": "user", + "content": [ + { + "type": "image", + "source": { + "type": "base64", + "media_type": "image/jpeg", + "data": "/9j/4AAQSkZJRg..." + } + }, + { "type": "text", "text": "What is in this image?" } + ] + } + ``` + + We currently support the `base64` source type for images, and the `image/jpeg`, + `image/png`, `image/gif`, and `image/webp` media types. + + See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for + more input examples. + + Note that if you want to include a + [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use + the top-level `system` parameter — there is no `"system"` role for input + messages in the Messages API. + """ + + model: Required[ModelParam] + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + system: Union[str, Iterable[BetaTextBlockParam]] + """System prompt. + + A system prompt is a way of providing context and instructions to Claude, such + as specifying a particular goal or role. See our + [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + """ + + thinking: BetaThinkingConfigParam + """Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's + thinking process before the final answer. Requires a minimum budget of 1,024 + tokens and counts towards your `max_tokens` limit. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + tool_choice: BetaToolChoiceParam + """How the model should use the provided tools. + + The model can use a specific tool, any available tool, decide by itself, or not + use tools at all. + """ + + tools: Iterable[Tool] + """Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` + content blocks that represent the model's use of those tools. You can then run + those tools using the tool input generated by the model and then optionally + return results back to the model using `tool_result` content blocks. + + Each tool definition includes: + + - `name`: Name of the tool. + - `description`: Optional, but strongly-recommended description of the tool. + - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the + tool `input` shape that the model will produce in `tool_use` output content + blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce + `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an + input, and return the following back to the model in a subsequent `user` + message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and + functions, or more generally whenever you want the model to produce a particular + JSON structure of output. + + See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + """ + + betas: Annotated[List[AnthropicBetaParam], PropertyInfo(alias="anthropic-beta")] + """Optional header to specify the beta version(s) you want to use.""" + + +Tool: TypeAlias = Union[ + BetaToolParam, + BetaToolComputerUse20241022Param, + BetaToolBash20241022Param, + BetaToolTextEditor20241022Param, + BetaToolComputerUse20250124Param, + BetaToolBash20250124Param, + BetaToolTextEditor20250124Param, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_create_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_create_params.py new file mode 100644 index 00000000..e05f92da --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/message_create_params.py @@ -0,0 +1,297 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo +from ..model_param import ModelParam +from .beta_message_param import BetaMessageParam +from .beta_metadata_param import BetaMetadataParam +from ..anthropic_beta_param import AnthropicBetaParam +from .beta_text_block_param import BetaTextBlockParam +from .beta_tool_union_param import BetaToolUnionParam +from .beta_tool_choice_param import BetaToolChoiceParam +from .beta_thinking_config_param import BetaThinkingConfigParam + +__all__ = ["MessageCreateParamsBase", "MessageCreateParamsNonStreaming", "MessageCreateParamsStreaming"] + + +class MessageCreateParamsBase(TypedDict, total=False): + max_tokens: Required[int] + """The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter + only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See + [models](https://docs.anthropic.com/en/docs/models-overview) for details. + """ + + messages: Required[Iterable[BetaMessageParam]] + """Input messages. + + Our models are trained to operate on alternating `user` and `assistant` + conversational turns. When creating a new `Message`, you specify the prior + conversational turns with the `messages` parameter, and the model then generates + the next `Message` in the conversation. Consecutive `user` or `assistant` turns + in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can + specify a single `user`-role message, or you can include multiple `user` and + `assistant` messages. + + If the final message uses the `assistant` role, the response content will + continue immediately from the content in that message. This can be used to + constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{ "role": "user", "content": "Hello, Claude" }] + ``` + + Example with multiple conversational turns: + + ```json + [ + { "role": "user", "content": "Hello there." }, + { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, + { "role": "user", "content": "Can you explain LLMs in plain English?" } + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Each input message `content` may be either a single `string` or an array of + content blocks, where each block has a specific `type`. Using a `string` for + `content` is shorthand for an array of one content block of type `"text"`. The + following input messages are equivalent: + + ```json + { "role": "user", "content": "Hello, Claude" } + ``` + + ```json + { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } + ``` + + Starting with Claude 3 models, you can also send image content blocks: + + ```json + { + "role": "user", + "content": [ + { + "type": "image", + "source": { + "type": "base64", + "media_type": "image/jpeg", + "data": "/9j/4AAQSkZJRg..." + } + }, + { "type": "text", "text": "What is in this image?" } + ] + } + ``` + + We currently support the `base64` source type for images, and the `image/jpeg`, + `image/png`, `image/gif`, and `image/webp` media types. + + See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for + more input examples. + + Note that if you want to include a + [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use + the top-level `system` parameter — there is no `"system"` role for input + messages in the Messages API. + """ + + model: Required[ModelParam] + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + metadata: BetaMetadataParam + """An object describing metadata about the request.""" + + stop_sequences: List[str] + """Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, + which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of + text, you can use the `stop_sequences` parameter. If the model encounters one of + the custom sequences, the response `stop_reason` value will be `"stop_sequence"` + and the response `stop_sequence` value will contain the matched stop sequence. + """ + + system: Union[str, Iterable[BetaTextBlockParam]] + """System prompt. + + A system prompt is a way of providing context and instructions to Claude, such + as specifying a particular goal or role. See our + [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + """ + + temperature: float + """Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` + for analytical / multiple choice, and closer to `1.0` for creative and + generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully + deterministic. + """ + + thinking: BetaThinkingConfigParam + """Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's + thinking process before the final answer. Requires a minimum budget of 1,024 + tokens and counts towards your `max_tokens` limit. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + tool_choice: BetaToolChoiceParam + """How the model should use the provided tools. + + The model can use a specific tool, any available tool, decide by itself, or not + use tools at all. + """ + + tools: Iterable[BetaToolUnionParam] + """Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` + content blocks that represent the model's use of those tools. You can then run + those tools using the tool input generated by the model and then optionally + return results back to the model using `tool_result` content blocks. + + Each tool definition includes: + + - `name`: Name of the tool. + - `description`: Optional, but strongly-recommended description of the tool. + - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the + tool `input` shape that the model will produce in `tool_use` output content + blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce + `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an + input, and return the following back to the model in a subsequent `user` + message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and + functions, or more generally whenever you want the model to produce a particular + JSON structure of output. + + See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + """ + + top_k: int + """Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. + [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + top_p: float + """Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options + for each subsequent token in decreasing probability order and cut it off once it + reaches a particular probability specified by `top_p`. You should either alter + `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + betas: Annotated[List[AnthropicBetaParam], PropertyInfo(alias="anthropic-beta")] + """Optional header to specify the beta version(s) you want to use.""" + + +class MessageCreateParamsNonStreaming(MessageCreateParamsBase, total=False): + stream: Literal[False] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for + details. + """ + + +class MessageCreateParamsStreaming(MessageCreateParamsBase): + stream: Required[Literal[True]] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for + details. + """ + + +MessageCreateParams = Union[MessageCreateParamsNonStreaming, MessageCreateParamsStreaming] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/__init__.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/__init__.py new file mode 100644 index 00000000..fef14dd1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/__init__.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .batch_list_params import BatchListParams as BatchListParams +from .beta_message_batch import BetaMessageBatch as BetaMessageBatch +from .batch_create_params import BatchCreateParams as BatchCreateParams +from .beta_message_batch_result import BetaMessageBatchResult as BetaMessageBatchResult +from .beta_deleted_message_batch import BetaDeletedMessageBatch as BetaDeletedMessageBatch +from .beta_message_batch_errored_result import BetaMessageBatchErroredResult as BetaMessageBatchErroredResult +from .beta_message_batch_expired_result import BetaMessageBatchExpiredResult as BetaMessageBatchExpiredResult +from .beta_message_batch_request_counts import BetaMessageBatchRequestCounts as BetaMessageBatchRequestCounts +from .beta_message_batch_canceled_result import BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult +from .beta_message_batch_succeeded_result import BetaMessageBatchSucceededResult as BetaMessageBatchSucceededResult +from .beta_message_batch_individual_response import ( + BetaMessageBatchIndividualResponse as BetaMessageBatchIndividualResponse, +) diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_create_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_create_params.py new file mode 100644 index 00000000..8eb9c4af --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_create_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Iterable +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo +from ...anthropic_beta_param import AnthropicBetaParam +from ..message_create_params import MessageCreateParamsNonStreaming + +__all__ = ["BatchCreateParams", "Request"] + + +class BatchCreateParams(TypedDict, total=False): + requests: Required[Iterable[Request]] + """List of requests for prompt completion. + + Each is an individual request to create a Message. + """ + + betas: Annotated[List[AnthropicBetaParam], PropertyInfo(alias="anthropic-beta")] + """Optional header to specify the beta version(s) you want to use.""" + + +class Request(TypedDict, total=False): + custom_id: Required[str] + """Developer-provided ID created for each request in a Message Batch. + + Useful for matching results to requests, as results may be given out of request + order. + + Must be unique for each request within the Message Batch. + """ + + params: Required[MessageCreateParamsNonStreaming] + """Messages API creation parameters for the individual request. + + See the [Messages API reference](/en/api/messages) for full documentation on + available parameters. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_list_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_list_params.py new file mode 100644 index 00000000..3f406251 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/batch_list_params.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Annotated, TypedDict + +from ...._utils import PropertyInfo +from ...anthropic_beta_param import AnthropicBetaParam + +__all__ = ["BatchListParams"] + + +class BatchListParams(TypedDict, total=False): + after_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately after this object. + """ + + before_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately before this object. + """ + + limit: int + """Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + """ + + betas: Annotated[List[AnthropicBetaParam], PropertyInfo(alias="anthropic-beta")] + """Optional header to specify the beta version(s) you want to use.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_deleted_message_batch.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_deleted_message_batch.py new file mode 100644 index 00000000..f7dd1d52 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_deleted_message_batch.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BetaDeletedMessageBatch"] + + +class BetaDeletedMessageBatch(BaseModel): + id: str + """ID of the Message Batch.""" + + type: Literal["message_batch_deleted"] + """Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch.py new file mode 100644 index 00000000..1ea92c3a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel +from .beta_message_batch_request_counts import BetaMessageBatchRequestCounts + +__all__ = ["BetaMessageBatch"] + + +class BetaMessageBatch(BaseModel): + id: str + """Unique object identifier. + + The format and length of IDs may change over time. + """ + + archived_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which the Message Batch was + archived and its results became unavailable. + """ + + cancel_initiated_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which cancellation was + initiated for the Message Batch. Specified only if cancellation was initiated. + """ + + created_at: datetime + """ + RFC 3339 datetime string representing the time at which the Message Batch was + created. + """ + + ended_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which processing for the + Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, + errored, canceled, or expired. + """ + + expires_at: datetime + """ + RFC 3339 datetime string representing the time at which the Message Batch will + expire and end processing, which is 24 hours after creation. + """ + + processing_status: Literal["in_progress", "canceling", "ended"] + """Processing status of the Message Batch.""" + + request_counts: BetaMessageBatchRequestCounts + """Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once + processing of the entire batch ends. The sum of all values always matches the + total number of requests in the batch. + """ + + results_url: Optional[str] = None + """URL to a `.jsonl` file containing the results of the Message Batch requests. + + Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use + the `custom_id` field to match results to requests. + """ + + type: Literal["message_batch"] + """Object type. + + For Message Batches, this is always `"message_batch"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_canceled_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_canceled_result.py new file mode 100644 index 00000000..e5dae348 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_canceled_result.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BetaMessageBatchCanceledResult"] + + +class BetaMessageBatchCanceledResult(BaseModel): + type: Literal["canceled"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_errored_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_errored_result.py new file mode 100644 index 00000000..44ea9027 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_errored_result.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel +from ...beta_error_response import BetaErrorResponse + +__all__ = ["BetaMessageBatchErroredResult"] + + +class BetaMessageBatchErroredResult(BaseModel): + error: BetaErrorResponse + + type: Literal["errored"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_expired_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_expired_result.py new file mode 100644 index 00000000..0dbfde41 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_expired_result.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["BetaMessageBatchExpiredResult"] + + +class BetaMessageBatchExpiredResult(BaseModel): + type: Literal["expired"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_individual_response.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_individual_response.py new file mode 100644 index 00000000..8c493934 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_individual_response.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ...._models import BaseModel +from .beta_message_batch_result import BetaMessageBatchResult + +__all__ = ["BetaMessageBatchIndividualResponse"] + + +class BetaMessageBatchIndividualResponse(BaseModel): + custom_id: str + """Developer-provided ID created for each request in a Message Batch. + + Useful for matching results to requests, as results may be given out of request + order. + + Must be unique for each request within the Message Batch. + """ + + result: BetaMessageBatchResult + """Processing result for this request. + + Contains a Message output if processing was successful, an error response if + processing failed, or the reason why processing was not attempted, such as + cancellation or expiration. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_request_counts.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_request_counts.py new file mode 100644 index 00000000..48e6952f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_request_counts.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ...._models import BaseModel + +__all__ = ["BetaMessageBatchRequestCounts"] + + +class BetaMessageBatchRequestCounts(BaseModel): + canceled: int + """Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + """ + + errored: int + """Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + """ + + expired: int + """Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + """ + + processing: int + """Number of requests in the Message Batch that are processing.""" + + succeeded: int + """Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_result.py new file mode 100644 index 00000000..78ca7317 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_result.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ...._utils import PropertyInfo +from .beta_message_batch_errored_result import BetaMessageBatchErroredResult +from .beta_message_batch_expired_result import BetaMessageBatchExpiredResult +from .beta_message_batch_canceled_result import BetaMessageBatchCanceledResult +from .beta_message_batch_succeeded_result import BetaMessageBatchSucceededResult + +__all__ = ["BetaMessageBatchResult"] + +BetaMessageBatchResult: TypeAlias = Annotated[ + Union[ + BetaMessageBatchSucceededResult, + BetaMessageBatchErroredResult, + BetaMessageBatchCanceledResult, + BetaMessageBatchExpiredResult, + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_succeeded_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_succeeded_result.py new file mode 100644 index 00000000..94389d60 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/messages/beta_message_batch_succeeded_result.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ...._models import BaseModel +from ..beta_message import BetaMessage + +__all__ = ["BetaMessageBatchSucceededResult"] + + +class BetaMessageBatchSucceededResult(BaseModel): + message: BetaMessage + + type: Literal["succeeded"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta/model_list_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta/model_list_params.py new file mode 100644 index 00000000..b16d22a3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta/model_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ModelListParams"] + + +class ModelListParams(TypedDict, total=False): + after_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately after this object. + """ + + before_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately before this object. + """ + + limit: int + """Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_api_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_api_error.py new file mode 100644 index 00000000..16aa604e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_api_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaAPIError"] + + +class BetaAPIError(BaseModel): + message: str + + type: Literal["api_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_authentication_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_authentication_error.py new file mode 100644 index 00000000..8a555570 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_authentication_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaAuthenticationError"] + + +class BetaAuthenticationError(BaseModel): + message: str + + type: Literal["authentication_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_billing_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_billing_error.py new file mode 100644 index 00000000..1ab37614 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_billing_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaBillingError"] + + +class BetaBillingError(BaseModel): + message: str + + type: Literal["billing_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_error.py new file mode 100644 index 00000000..029d80dc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_error.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .beta_api_error import BetaAPIError +from .beta_billing_error import BetaBillingError +from .beta_not_found_error import BetaNotFoundError +from .beta_overloaded_error import BetaOverloadedError +from .beta_permission_error import BetaPermissionError +from .beta_rate_limit_error import BetaRateLimitError +from .beta_authentication_error import BetaAuthenticationError +from .beta_gateway_timeout_error import BetaGatewayTimeoutError +from .beta_invalid_request_error import BetaInvalidRequestError + +__all__ = ["BetaError"] + +BetaError: TypeAlias = Annotated[ + Union[ + BetaInvalidRequestError, + BetaAuthenticationError, + BetaBillingError, + BetaPermissionError, + BetaNotFoundError, + BetaRateLimitError, + BetaGatewayTimeoutError, + BetaAPIError, + BetaOverloadedError, + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_error_response.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_error_response.py new file mode 100644 index 00000000..1751183e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_error_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel +from .beta_error import BetaError + +__all__ = ["BetaErrorResponse"] + + +class BetaErrorResponse(BaseModel): + error: BetaError + + type: Literal["error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_gateway_timeout_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_gateway_timeout_error.py new file mode 100644 index 00000000..9a29705b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_gateway_timeout_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaGatewayTimeoutError"] + + +class BetaGatewayTimeoutError(BaseModel): + message: str + + type: Literal["timeout_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_invalid_request_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_invalid_request_error.py new file mode 100644 index 00000000..a84d53cc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_invalid_request_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaInvalidRequestError"] + + +class BetaInvalidRequestError(BaseModel): + message: str + + type: Literal["invalid_request_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_not_found_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_not_found_error.py new file mode 100644 index 00000000..3d57cb5a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_not_found_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaNotFoundError"] + + +class BetaNotFoundError(BaseModel): + message: str + + type: Literal["not_found_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_overloaded_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_overloaded_error.py new file mode 100644 index 00000000..ff5dbe81 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_overloaded_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaOverloadedError"] + + +class BetaOverloadedError(BaseModel): + message: str + + type: Literal["overloaded_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_permission_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_permission_error.py new file mode 100644 index 00000000..986cf894 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_permission_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaPermissionError"] + + +class BetaPermissionError(BaseModel): + message: str + + type: Literal["permission_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/beta_rate_limit_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/beta_rate_limit_error.py new file mode 100644 index 00000000..ae3cb1ae --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/beta_rate_limit_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BetaRateLimitError"] + + +class BetaRateLimitError(BaseModel): + message: str + + type: Literal["rate_limit_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/cache_control_ephemeral_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/cache_control_ephemeral_param.py new file mode 100644 index 00000000..8900071e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/cache_control_ephemeral_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CacheControlEphemeralParam"] + + +class CacheControlEphemeralParam(TypedDict, total=False): + type: Required[Literal["ephemeral"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location.py new file mode 100644 index 00000000..011b1066 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CitationCharLocation"] + + +class CitationCharLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_char_index: int + + start_char_index: int + + type: Literal["char_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location_param.py new file mode 100644 index 00000000..1cc1dfb1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_char_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CitationCharLocationParam"] + + +class CitationCharLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_char_index: Required[int] + + start_char_index: Required[int] + + type: Required[Literal["char_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location.py new file mode 100644 index 00000000..0df0ce57 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CitationContentBlockLocation"] + + +class CitationContentBlockLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_block_index: int + + start_block_index: int + + type: Literal["content_block_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location_param.py new file mode 100644 index 00000000..ee0a6a23 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_content_block_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CitationContentBlockLocationParam"] + + +class CitationContentBlockLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_block_index: Required[int] + + start_block_index: Required[int] + + type: Required[Literal["content_block_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location.py new file mode 100644 index 00000000..94c4d509 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CitationPageLocation"] + + +class CitationPageLocation(BaseModel): + cited_text: str + + document_index: int + + document_title: Optional[str] = None + + end_page_number: int + + start_page_number: int + + type: Literal["page_location"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location_param.py new file mode 100644 index 00000000..483837b5 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citation_page_location_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CitationPageLocationParam"] + + +class CitationPageLocationParam(TypedDict, total=False): + cited_text: Required[str] + + document_index: Required[int] + + document_title: Required[Optional[str]] + + end_page_number: Required[int] + + start_page_number: Required[int] + + type: Required[Literal["page_location"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citations_config_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/citations_config_param.py new file mode 100644 index 00000000..817397f8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citations_config_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CitationsConfigParam"] + + +class CitationsConfigParam(TypedDict, total=False): + enabled: bool diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/citations_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/citations_delta.py new file mode 100644 index 00000000..3eab03d1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/citations_delta.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from .._utils import PropertyInfo +from .._models import BaseModel +from .citation_char_location import CitationCharLocation +from .citation_page_location import CitationPageLocation +from .citation_content_block_location import CitationContentBlockLocation + +__all__ = ["CitationsDelta", "Citation"] + +Citation: TypeAlias = Annotated[ + Union[CitationCharLocation, CitationPageLocation, CitationContentBlockLocation], PropertyInfo(discriminator="type") +] + + +class CitationsDelta(BaseModel): + citation: Citation + + type: Literal["citations_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/completion.py b/.venv/lib/python3.12/site-packages/anthropic/types/completion.py new file mode 100644 index 00000000..e6293210 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/completion.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .model import Model +from .._models import BaseModel + +__all__ = ["Completion"] + + +class Completion(BaseModel): + id: str + """Unique object identifier. + + The format and length of IDs may change over time. + """ + + completion: str + """The resulting completion up to and excluding the stop sequences.""" + + model: Model + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + stop_reason: Optional[str] = None + """The reason that we stopped. + + This may be one the following values: + + - `"stop_sequence"`: we reached a stop sequence — either provided by you via the + `stop_sequences` parameter, or a stop sequence built into the model + - `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum + """ + + type: Literal["completion"] + """Object type. + + For Text Completions, this is always `"completion"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/completion_create_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/completion_create_params.py new file mode 100644 index 00000000..0eb25725 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/completion_create_params.py @@ -0,0 +1,131 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .model_param import ModelParam +from .metadata_param import MetadataParam + +__all__ = [ + "CompletionRequestStreamingMetadata", + "CompletionRequestNonStreamingMetadata", + "CompletionRequestNonStreaming", + "CompletionRequestStreaming", + "CompletionCreateParamsBase", + "Metadata", + "CompletionCreateParamsNonStreaming", + "CompletionCreateParamsStreaming", +] + + +class CompletionCreateParamsBase(TypedDict, total=False): + max_tokens_to_sample: Required[int] + """The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter + only specifies the absolute maximum number of tokens to generate. + """ + + model: Required[ModelParam] + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + prompt: Required[str] + """The prompt that you want Claude to complete. + + For proper response generation you will need to format your prompt using + alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example: + + ``` + "\n\nHuman: {userQuestion}\n\nAssistant:" + ``` + + See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and + our guide to + [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more + details. + """ + + metadata: MetadataParam + """An object describing metadata about the request.""" + + stop_sequences: List[str] + """Sequences that will cause the model to stop generating. + + Our models stop on `"\n\nHuman:"`, and may include additional built-in stop + sequences in the future. By providing the stop_sequences parameter, you may + include additional strings that will cause the model to stop generating. + """ + + temperature: float + """Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` + for analytical / multiple choice, and closer to `1.0` for creative and + generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully + deterministic. + """ + + top_k: int + """Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. + [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + top_p: float + """Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options + for each subsequent token in decreasing probability order and cut it off once it + reaches a particular probability specified by `top_p`. You should either alter + `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + +Metadata: TypeAlias = MetadataParam +"""This is deprecated, `MetadataParam` should be used instead""" + + +class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False): + stream: Literal[False] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + """ + + +class CompletionCreateParamsStreaming(CompletionCreateParamsBase): + stream: Required[Literal[True]] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/streaming) for details. + """ + + +CompletionRequestStreamingMetadata = MetadataParam +"""This is deprecated, `MetadataParam` should be used instead""" + +CompletionRequestNonStreamingMetadata = MetadataParam +"""This is deprecated, `MetadataParam` should be used instead""" + +CompletionRequestNonStreaming = CompletionCreateParamsNonStreaming +"""This is deprecated, `CompletionCreateParamsNonStreaming` should be used instead""" + +CompletionRequestStreaming = CompletionCreateParamsStreaming +"""This is deprecated, `CompletionCreateParamsStreaming` should be used instead""" + +CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block.py new file mode 100644 index 00000000..1bc77596 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .text_block import TextBlock +from .thinking_block import ThinkingBlock +from .tool_use_block import ToolUseBlock +from .redacted_thinking_block import RedactedThinkingBlock + +__all__ = ["ContentBlock"] + +ContentBlock: TypeAlias = Annotated[ + Union[TextBlock, ToolUseBlock, ThinkingBlock, RedactedThinkingBlock], PropertyInfo(discriminator="type") +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_delta_event.py new file mode 100644 index 00000000..a32602b4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_delta_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_content_block_delta_event import RawContentBlockDeltaEvent + +__all__ = ["ContentBlockDeltaEvent"] + +ContentBlockDeltaEvent = RawContentBlockDeltaEvent +"""The RawContentBlockDeltaEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_param.py new file mode 100644 index 00000000..97f132e7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .text_block_param import TextBlockParam +from .image_block_param import ImageBlockParam +from .document_block_param import DocumentBlockParam +from .thinking_block_param import ThinkingBlockParam +from .tool_use_block_param import ToolUseBlockParam +from .tool_result_block_param import ToolResultBlockParam +from .redacted_thinking_block_param import RedactedThinkingBlockParam + +__all__ = ["ContentBlockParam"] + +ContentBlockParam: TypeAlias = Union[ + TextBlockParam, + ImageBlockParam, + ToolUseBlockParam, + ToolResultBlockParam, + DocumentBlockParam, + ThinkingBlockParam, + RedactedThinkingBlockParam, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_content_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_content_param.py new file mode 100644 index 00000000..0e70cd25 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_content_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .text_block_param import TextBlockParam +from .image_block_param import ImageBlockParam + +__all__ = ["ContentBlockSourceContentParam"] + +ContentBlockSourceContentParam: TypeAlias = Union[TextBlockParam, ImageBlockParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_param.py new file mode 100644 index 00000000..8050f3e6 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_source_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .content_block_source_content_param import ContentBlockSourceContentParam + +__all__ = ["ContentBlockSourceParam"] + + +class ContentBlockSourceParam(TypedDict, total=False): + content: Required[Union[str, Iterable[ContentBlockSourceContentParam]]] + + type: Required[Literal["content"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_start_event.py new file mode 100644 index 00000000..873cba3b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_start_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_content_block_start_event import RawContentBlockStartEvent + +__all__ = ["ContentBlockStartEvent"] + +ContentBlockStartEvent = RawContentBlockStartEvent +"""The RawContentBlockStartEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/content_block_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_stop_event.py new file mode 100644 index 00000000..36c62c89 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/content_block_stop_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_content_block_stop_event import RawContentBlockStopEvent + +__all__ = ["ContentBlockStopEvent"] + +ContentBlockStopEvent = RawContentBlockStopEvent +"""The RawContentBlockStopEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/document_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/document_block_param.py new file mode 100644 index 00000000..e3285266 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/document_block_param.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .url_pdf_source_param import URLPDFSourceParam +from .citations_config_param import CitationsConfigParam +from .base64_pdf_source_param import Base64PDFSourceParam +from .plain_text_source_param import PlainTextSourceParam +from .content_block_source_param import ContentBlockSourceParam +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["DocumentBlockParam", "Source"] + +Source: TypeAlias = Union[Base64PDFSourceParam, PlainTextSourceParam, ContentBlockSourceParam, URLPDFSourceParam] + + +class DocumentBlockParam(TypedDict, total=False): + source: Required[Source] + + type: Required[Literal["document"]] + + cache_control: Optional[CacheControlEphemeralParam] + + citations: CitationsConfigParam + + context: Optional[str] + + title: Optional[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/image_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/image_block_param.py new file mode 100644 index 00000000..914ed6bb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/image_block_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .url_image_source_param import URLImageSourceParam +from .base64_image_source_param import Base64ImageSourceParam +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ImageBlockParam", "Source"] + +Source: TypeAlias = Union[Base64ImageSourceParam, URLImageSourceParam] + + +class ImageBlockParam(TypedDict, total=False): + source: Required[Source] + + type: Required[Literal["image"]] + + cache_control: Optional[CacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/input_json_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/input_json_delta.py new file mode 100644 index 00000000..5d735d72 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/input_json_delta.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["InputJSONDelta", "InputJsonDelta"] + + +class InputJSONDelta(BaseModel): + partial_json: str + + type: Literal["input_json_delta"] + + +InputJsonDelta = InputJSONDelta diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message.py b/.venv/lib/python3.12/site-packages/anthropic/types/message.py new file mode 100644 index 00000000..6179ee12 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .model import Model +from .usage import Usage +from .._models import BaseModel +from .content_block import ContentBlock, ContentBlock as ContentBlock + +__all__ = ["Message"] + + +class Message(BaseModel): + id: str + """Unique object identifier. + + The format and length of IDs may change over time. + """ + + content: List[ContentBlock] + """Content generated by the model. + + This is an array of content blocks, each of which has a `type` that determines + its shape. + + Example: + + ```json + [{ "type": "text", "text": "Hi, I'm Claude." }] + ``` + + If the request input `messages` ended with an `assistant` turn, then the + response `content` will continue directly from that last turn. You can use this + to constrain the model's output. + + For example, if the input `messages` were: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Then the response `content` might be: + + ```json + [{ "type": "text", "text": "B)" }] + ``` + """ + + model: Model + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + role: Literal["assistant"] + """Conversational role of the generated message. + + This will always be `"assistant"`. + """ + + stop_reason: Optional[Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]] = None + """The reason that we stopped. + + This may be one the following values: + + - `"end_turn"`: the model reached a natural stopping point + - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + - `"tool_use"`: the model invoked one or more tools + + In non-streaming mode this value is always non-null. In streaming mode, it is + null in the `message_start` event and non-null otherwise. + """ + + stop_sequence: Optional[str] = None + """Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was + generated. + """ + + type: Literal["message"] + """Object type. + + For Messages, this is always `"message"`. + """ + + usage: Usage + """Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the + underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the + model. The model's output then goes through a parsing stage before becoming an + API response. As a result, the token counts in `usage` will not match one-to-one + with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response + from Claude. + + Total input tokens in a request is the summation of `input_tokens`, + `cache_creation_input_tokens`, and `cache_read_input_tokens`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_params.py new file mode 100644 index 00000000..ea88dd5d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_params.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypedDict + +from .model_param import ModelParam +from .message_param import MessageParam +from .text_block_param import TextBlockParam +from .tool_choice_param import ToolChoiceParam +from .thinking_config_param import ThinkingConfigParam +from .message_count_tokens_tool_param import MessageCountTokensToolParam + +__all__ = ["MessageCountTokensParams"] + + +class MessageCountTokensParams(TypedDict, total=False): + messages: Required[Iterable[MessageParam]] + """Input messages. + + Our models are trained to operate on alternating `user` and `assistant` + conversational turns. When creating a new `Message`, you specify the prior + conversational turns with the `messages` parameter, and the model then generates + the next `Message` in the conversation. Consecutive `user` or `assistant` turns + in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can + specify a single `user`-role message, or you can include multiple `user` and + `assistant` messages. + + If the final message uses the `assistant` role, the response content will + continue immediately from the content in that message. This can be used to + constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{ "role": "user", "content": "Hello, Claude" }] + ``` + + Example with multiple conversational turns: + + ```json + [ + { "role": "user", "content": "Hello there." }, + { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, + { "role": "user", "content": "Can you explain LLMs in plain English?" } + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Each input message `content` may be either a single `string` or an array of + content blocks, where each block has a specific `type`. Using a `string` for + `content` is shorthand for an array of one content block of type `"text"`. The + following input messages are equivalent: + + ```json + { "role": "user", "content": "Hello, Claude" } + ``` + + ```json + { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } + ``` + + Starting with Claude 3 models, you can also send image content blocks: + + ```json + { + "role": "user", + "content": [ + { + "type": "image", + "source": { + "type": "base64", + "media_type": "image/jpeg", + "data": "/9j/4AAQSkZJRg..." + } + }, + { "type": "text", "text": "What is in this image?" } + ] + } + ``` + + We currently support the `base64` source type for images, and the `image/jpeg`, + `image/png`, `image/gif`, and `image/webp` media types. + + See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for + more input examples. + + Note that if you want to include a + [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use + the top-level `system` parameter — there is no `"system"` role for input + messages in the Messages API. + """ + + model: Required[ModelParam] + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + system: Union[str, Iterable[TextBlockParam]] + """System prompt. + + A system prompt is a way of providing context and instructions to Claude, such + as specifying a particular goal or role. See our + [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + """ + + thinking: ThinkingConfigParam + """Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's + thinking process before the final answer. Requires a minimum budget of 1,024 + tokens and counts towards your `max_tokens` limit. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + tool_choice: ToolChoiceParam + """How the model should use the provided tools. + + The model can use a specific tool, any available tool, decide by itself, or not + use tools at all. + """ + + tools: Iterable[MessageCountTokensToolParam] + """Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` + content blocks that represent the model's use of those tools. You can then run + those tools using the tool input generated by the model and then optionally + return results back to the model using `tool_result` content blocks. + + Each tool definition includes: + + - `name`: Name of the tool. + - `description`: Optional, but strongly-recommended description of the tool. + - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the + tool `input` shape that the model will produce in `tool_use` output content + blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce + `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an + input, and return the following back to the model in a subsequent `user` + message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and + functions, or more generally whenever you want the model to produce a particular + JSON structure of output. + + See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_tool_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_tool_param.py new file mode 100644 index 00000000..e28c0ccf --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_count_tokens_tool_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .tool_param import ToolParam +from .tool_bash_20250124_param import ToolBash20250124Param +from .tool_text_editor_20250124_param import ToolTextEditor20250124Param + +__all__ = ["MessageCountTokensToolParam"] + +MessageCountTokensToolParam: TypeAlias = Union[ToolParam, ToolBash20250124Param, ToolTextEditor20250124Param] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_create_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_create_params.py new file mode 100644 index 00000000..c079bafd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_create_params.py @@ -0,0 +1,320 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .model_param import ModelParam +from .message_param import MessageParam +from .metadata_param import MetadataParam +from .text_block_param import TextBlockParam +from .tool_union_param import ToolUnionParam +from .tool_choice_param import ToolChoiceParam +from .thinking_config_param import ThinkingConfigParam +from .tool_choice_any_param import ToolChoiceAnyParam +from .tool_choice_auto_param import ToolChoiceAutoParam +from .tool_choice_tool_param import ToolChoiceToolParam + +__all__ = [ + "MessageCreateParamsBase", + "Metadata", + "ToolChoice", + "ToolChoiceToolChoiceAuto", + "ToolChoiceToolChoiceAny", + "ToolChoiceToolChoiceTool", + "MessageCreateParamsNonStreaming", + "MessageCreateParamsStreaming", +] + + +class MessageCreateParamsBase(TypedDict, total=False): + max_tokens: Required[int] + """The maximum number of tokens to generate before stopping. + + Note that our models may stop _before_ reaching this maximum. This parameter + only specifies the absolute maximum number of tokens to generate. + + Different models have different maximum values for this parameter. See + [models](https://docs.anthropic.com/en/docs/models-overview) for details. + """ + + messages: Required[Iterable[MessageParam]] + """Input messages. + + Our models are trained to operate on alternating `user` and `assistant` + conversational turns. When creating a new `Message`, you specify the prior + conversational turns with the `messages` parameter, and the model then generates + the next `Message` in the conversation. Consecutive `user` or `assistant` turns + in your request will be combined into a single turn. + + Each input message must be an object with a `role` and `content`. You can + specify a single `user`-role message, or you can include multiple `user` and + `assistant` messages. + + If the final message uses the `assistant` role, the response content will + continue immediately from the content in that message. This can be used to + constrain part of the model's response. + + Example with a single `user` message: + + ```json + [{ "role": "user", "content": "Hello, Claude" }] + ``` + + Example with multiple conversational turns: + + ```json + [ + { "role": "user", "content": "Hello there." }, + { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, + { "role": "user", "content": "Can you explain LLMs in plain English?" } + ] + ``` + + Example with a partially-filled response from Claude: + + ```json + [ + { + "role": "user", + "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" + }, + { "role": "assistant", "content": "The best answer is (" } + ] + ``` + + Each input message `content` may be either a single `string` or an array of + content blocks, where each block has a specific `type`. Using a `string` for + `content` is shorthand for an array of one content block of type `"text"`. The + following input messages are equivalent: + + ```json + { "role": "user", "content": "Hello, Claude" } + ``` + + ```json + { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } + ``` + + Starting with Claude 3 models, you can also send image content blocks: + + ```json + { + "role": "user", + "content": [ + { + "type": "image", + "source": { + "type": "base64", + "media_type": "image/jpeg", + "data": "/9j/4AAQSkZJRg..." + } + }, + { "type": "text", "text": "What is in this image?" } + ] + } + ``` + + We currently support the `base64` source type for images, and the `image/jpeg`, + `image/png`, `image/gif`, and `image/webp` media types. + + See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for + more input examples. + + Note that if you want to include a + [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use + the top-level `system` parameter — there is no `"system"` role for input + messages in the Messages API. + """ + + model: Required[ModelParam] + """ + The model that will complete your prompt.\n\nSee + [models](https://docs.anthropic.com/en/docs/models-overview) for additional + details and options. + """ + + metadata: MetadataParam + """An object describing metadata about the request.""" + + stop_sequences: List[str] + """Custom text sequences that will cause the model to stop generating. + + Our models will normally stop when they have naturally completed their turn, + which will result in a response `stop_reason` of `"end_turn"`. + + If you want the model to stop generating when it encounters custom strings of + text, you can use the `stop_sequences` parameter. If the model encounters one of + the custom sequences, the response `stop_reason` value will be `"stop_sequence"` + and the response `stop_sequence` value will contain the matched stop sequence. + """ + + system: Union[str, Iterable[TextBlockParam]] + """System prompt. + + A system prompt is a way of providing context and instructions to Claude, such + as specifying a particular goal or role. See our + [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts). + """ + + temperature: float + """Amount of randomness injected into the response. + + Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` + for analytical / multiple choice, and closer to `1.0` for creative and + generative tasks. + + Note that even with `temperature` of `0.0`, the results will not be fully + deterministic. + """ + + thinking: ThinkingConfigParam + """Configuration for enabling Claude's extended thinking. + + When enabled, responses include `thinking` content blocks showing Claude's + thinking process before the final answer. Requires a minimum budget of 1,024 + tokens and counts towards your `max_tokens` limit. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + tool_choice: ToolChoiceParam + """How the model should use the provided tools. + + The model can use a specific tool, any available tool, decide by itself, or not + use tools at all. + """ + + tools: Iterable[ToolUnionParam] + """Definitions of tools that the model may use. + + If you include `tools` in your API request, the model may return `tool_use` + content blocks that represent the model's use of those tools. You can then run + those tools using the tool input generated by the model and then optionally + return results back to the model using `tool_result` content blocks. + + Each tool definition includes: + + - `name`: Name of the tool. + - `description`: Optional, but strongly-recommended description of the tool. + - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the + tool `input` shape that the model will produce in `tool_use` output content + blocks. + + For example, if you defined `tools` as: + + ```json + [ + { + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + ``` + + And then asked the model "What's the S&P 500 at today?", the model might produce + `tool_use` content blocks in the response like this: + + ```json + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + ``` + + You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an + input, and return the following back to the model in a subsequent `user` + message: + + ```json + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + ``` + + Tools can be used for workflows that include running client-side tools and + functions, or more generally whenever you want the model to produce a particular + JSON structure of output. + + See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + """ + + top_k: int + """Only sample from the top K options for each subsequent token. + + Used to remove "long tail" low probability responses. + [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + top_p: float + """Use nucleus sampling. + + In nucleus sampling, we compute the cumulative distribution over all the options + for each subsequent token in decreasing probability order and cut it off once it + reaches a particular probability specified by `top_p`. You should either alter + `temperature` or `top_p`, but not both. + + Recommended for advanced use cases only. You usually only need to use + `temperature`. + """ + + +Metadata: TypeAlias = MetadataParam +"""This is deprecated, `MetadataParam` should be used instead""" + +ToolChoice: TypeAlias = ToolChoiceParam +"""This is deprecated, `ToolChoiceParam` should be used instead""" + +ToolChoiceToolChoiceAuto: TypeAlias = ToolChoiceAutoParam +"""This is deprecated, `ToolChoiceAutoParam` should be used instead""" + +ToolChoiceToolChoiceAny: TypeAlias = ToolChoiceAnyParam +"""This is deprecated, `ToolChoiceAnyParam` should be used instead""" + +ToolChoiceToolChoiceTool: TypeAlias = ToolChoiceToolParam +"""This is deprecated, `ToolChoiceToolParam` should be used instead""" + + +class MessageCreateParamsNonStreaming(MessageCreateParamsBase, total=False): + stream: Literal[False] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for + details. + """ + + +class MessageCreateParamsStreaming(MessageCreateParamsBase): + stream: Required[Literal[True]] + """Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for + details. + """ + + +MessageCreateParams = Union[MessageCreateParamsNonStreaming, MessageCreateParamsStreaming] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_event.py new file mode 100644 index 00000000..3803629a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_message_delta_event import RawMessageDeltaEvent + +__all__ = ["MessageDeltaEvent"] + +MessageDeltaEvent = RawMessageDeltaEvent +"""The RawMessageDeltaEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_usage.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_usage.py new file mode 100644 index 00000000..e4321be4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_delta_usage.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .._models import BaseModel + +__all__ = ["MessageDeltaUsage"] + + +class MessageDeltaUsage(BaseModel): + output_tokens: int + """The cumulative number of output tokens which were used.""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_param.py new file mode 100644 index 00000000..3c054395 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_param.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict + +from .content_block import ContentBlock +from .text_block_param import TextBlockParam +from .image_block_param import ImageBlockParam +from .document_block_param import DocumentBlockParam +from .thinking_block_param import ThinkingBlockParam +from .tool_use_block_param import ToolUseBlockParam +from .tool_result_block_param import ToolResultBlockParam +from .redacted_thinking_block_param import RedactedThinkingBlockParam + +__all__ = ["MessageParam"] + + +class MessageParam(TypedDict, total=False): + content: Required[ + Union[ + str, + Iterable[ + Union[ + TextBlockParam, + ImageBlockParam, + ToolUseBlockParam, + ToolResultBlockParam, + DocumentBlockParam, + ThinkingBlockParam, + RedactedThinkingBlockParam, + ContentBlock, + ] + ], + ] + ] + + role: Required[Literal["user", "assistant"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_start_event.py new file mode 100644 index 00000000..c210d3ad --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_start_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_message_start_event import RawMessageStartEvent + +__all__ = ["MessageStartEvent"] + +MessageStartEvent = RawMessageStartEvent +"""The RawMessageStartEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_stop_event.py new file mode 100644 index 00000000..1076a62c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_stop_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_message_stop_event import RawMessageStopEvent + +__all__ = ["MessageStopEvent"] + +MessageStopEvent = RawMessageStopEvent +"""The RawMessageStopEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_stream_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_stream_event.py new file mode 100644 index 00000000..ec5a0125 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_stream_event.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .raw_message_stream_event import RawMessageStreamEvent + +__all__ = ["MessageStreamEvent"] + +MessageStreamEvent = RawMessageStreamEvent +"""The RawMessageStreamEvent type should be used instead""" diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/message_tokens_count.py b/.venv/lib/python3.12/site-packages/anthropic/types/message_tokens_count.py new file mode 100644 index 00000000..d570019f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/message_tokens_count.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from .._models import BaseModel + +__all__ = ["MessageTokensCount"] + + +class MessageTokensCount(BaseModel): + input_tokens: int + """ + The total number of tokens across the provided list of messages, system prompt, + and tools. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/__init__.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/__init__.py new file mode 100644 index 00000000..25d311da --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .message_batch import MessageBatch as MessageBatch +from .batch_list_params import BatchListParams as BatchListParams +from .batch_create_params import BatchCreateParams as BatchCreateParams +from .message_batch_result import MessageBatchResult as MessageBatchResult +from .deleted_message_batch import DeletedMessageBatch as DeletedMessageBatch +from .message_batch_errored_result import MessageBatchErroredResult as MessageBatchErroredResult +from .message_batch_expired_result import MessageBatchExpiredResult as MessageBatchExpiredResult +from .message_batch_request_counts import MessageBatchRequestCounts as MessageBatchRequestCounts +from .message_batch_canceled_result import MessageBatchCanceledResult as MessageBatchCanceledResult +from .message_batch_succeeded_result import MessageBatchSucceededResult as MessageBatchSucceededResult +from .message_batch_individual_response import MessageBatchIndividualResponse as MessageBatchIndividualResponse diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_create_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_create_params.py new file mode 100644 index 00000000..a82a5ff0 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_create_params.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +from ..message_create_params import MessageCreateParamsNonStreaming + +__all__ = ["BatchCreateParams", "Request"] + + +class BatchCreateParams(TypedDict, total=False): + requests: Required[Iterable[Request]] + """List of requests for prompt completion. + + Each is an individual request to create a Message. + """ + + +class Request(TypedDict, total=False): + custom_id: Required[str] + """Developer-provided ID created for each request in a Message Batch. + + Useful for matching results to requests, as results may be given out of request + order. + + Must be unique for each request within the Message Batch. + """ + + params: Required[MessageCreateParamsNonStreaming] + """Messages API creation parameters for the individual request. + + See the [Messages API reference](/en/api/messages) for full documentation on + available parameters. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_list_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_list_params.py new file mode 100644 index 00000000..7b290a77 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/batch_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["BatchListParams"] + + +class BatchListParams(TypedDict, total=False): + after_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately after this object. + """ + + before_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately before this object. + """ + + limit: int + """Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/deleted_message_batch.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/deleted_message_batch.py new file mode 100644 index 00000000..7a6c321e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/deleted_message_batch.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["DeletedMessageBatch"] + + +class DeletedMessageBatch(BaseModel): + id: str + """ID of the Message Batch.""" + + type: Literal["message_batch_deleted"] + """Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch.py new file mode 100644 index 00000000..a03e73e1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel +from .message_batch_request_counts import MessageBatchRequestCounts + +__all__ = ["MessageBatch"] + + +class MessageBatch(BaseModel): + id: str + """Unique object identifier. + + The format and length of IDs may change over time. + """ + + archived_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which the Message Batch was + archived and its results became unavailable. + """ + + cancel_initiated_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which cancellation was + initiated for the Message Batch. Specified only if cancellation was initiated. + """ + + created_at: datetime + """ + RFC 3339 datetime string representing the time at which the Message Batch was + created. + """ + + ended_at: Optional[datetime] = None + """ + RFC 3339 datetime string representing the time at which processing for the + Message Batch ended. Specified only once processing ends. + + Processing ends when every request in a Message Batch has either succeeded, + errored, canceled, or expired. + """ + + expires_at: datetime + """ + RFC 3339 datetime string representing the time at which the Message Batch will + expire and end processing, which is 24 hours after creation. + """ + + processing_status: Literal["in_progress", "canceling", "ended"] + """Processing status of the Message Batch.""" + + request_counts: MessageBatchRequestCounts + """Tallies requests within the Message Batch, categorized by their status. + + Requests start as `processing` and move to one of the other statuses only once + processing of the entire batch ends. The sum of all values always matches the + total number of requests in the batch. + """ + + results_url: Optional[str] = None + """URL to a `.jsonl` file containing the results of the Message Batch requests. + + Specified only once processing ends. + + Results in the file are not guaranteed to be in the same order as requests. Use + the `custom_id` field to match results to requests. + """ + + type: Literal["message_batch"] + """Object type. + + For Message Batches, this is always `"message_batch"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_canceled_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_canceled_result.py new file mode 100644 index 00000000..9826aa91 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_canceled_result.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["MessageBatchCanceledResult"] + + +class MessageBatchCanceledResult(BaseModel): + type: Literal["canceled"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_errored_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_errored_result.py new file mode 100644 index 00000000..5f890bfd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_errored_result.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.error_response import ErrorResponse + +__all__ = ["MessageBatchErroredResult"] + + +class MessageBatchErroredResult(BaseModel): + error: ErrorResponse + + type: Literal["errored"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_expired_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_expired_result.py new file mode 100644 index 00000000..ab9964e7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_expired_result.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["MessageBatchExpiredResult"] + + +class MessageBatchExpiredResult(BaseModel): + type: Literal["expired"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_individual_response.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_individual_response.py new file mode 100644 index 00000000..19d4f090 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_individual_response.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel +from .message_batch_result import MessageBatchResult + +__all__ = ["MessageBatchIndividualResponse"] + + +class MessageBatchIndividualResponse(BaseModel): + custom_id: str + """Developer-provided ID created for each request in a Message Batch. + + Useful for matching results to requests, as results may be given out of request + order. + + Must be unique for each request within the Message Batch. + """ + + result: MessageBatchResult + """Processing result for this request. + + Contains a Message output if processing was successful, an error response if + processing failed, or the reason why processing was not attempted, such as + cancellation or expiration. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_request_counts.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_request_counts.py new file mode 100644 index 00000000..04edc3c3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_request_counts.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["MessageBatchRequestCounts"] + + +class MessageBatchRequestCounts(BaseModel): + canceled: int + """Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + """ + + errored: int + """Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + """ + + expired: int + """Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + """ + + processing: int + """Number of requests in the Message Batch that are processing.""" + + succeeded: int + """Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_result.py new file mode 100644 index 00000000..3186f2aa --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_result.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ..._utils import PropertyInfo +from .message_batch_errored_result import MessageBatchErroredResult +from .message_batch_expired_result import MessageBatchExpiredResult +from .message_batch_canceled_result import MessageBatchCanceledResult +from .message_batch_succeeded_result import MessageBatchSucceededResult + +__all__ = ["MessageBatchResult"] + +MessageBatchResult: TypeAlias = Annotated[ + Union[ + MessageBatchSucceededResult, MessageBatchErroredResult, MessageBatchCanceledResult, MessageBatchExpiredResult + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_succeeded_result.py b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_succeeded_result.py new file mode 100644 index 00000000..1cc454a4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/messages/message_batch_succeeded_result.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..message import Message +from ..._models import BaseModel + +__all__ = ["MessageBatchSucceededResult"] + + +class MessageBatchSucceededResult(BaseModel): + message: Message + + type: Literal["succeeded"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/metadata_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/metadata_param.py new file mode 100644 index 00000000..b7bc1ea3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/metadata_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["MetadataParam"] + + +class MetadataParam(TypedDict, total=False): + user_id: Optional[str] + """An external identifier for the user who is associated with the request. + + This should be a uuid, hash value, or other opaque identifier. Anthropic may use + this id to help detect abuse. Do not include any identifying information such as + name, email address, or phone number. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/model.py b/.venv/lib/python3.12/site-packages/anthropic/types/model.py new file mode 100644 index 00000000..02d40800 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/model.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, TypeAlias + +__all__ = ["Model"] + +Model: TypeAlias = Union[ + Literal[ + "claude-3-7-sonnet-latest", + "claude-3-7-sonnet-20250219", + "claude-3-5-haiku-latest", + "claude-3-5-haiku-20241022", + "claude-3-5-sonnet-latest", + "claude-3-5-sonnet-20241022", + "claude-3-5-sonnet-20240620", + "claude-3-opus-latest", + "claude-3-opus-20240229", + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2.1", + "claude-2.0", + ], + str, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/model_info.py b/.venv/lib/python3.12/site-packages/anthropic/types/model_info.py new file mode 100644 index 00000000..0e3945fe --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/model_info.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ModelInfo"] + + +class ModelInfo(BaseModel): + id: str + """Unique model identifier.""" + + created_at: datetime + """RFC 3339 datetime string representing the time at which the model was released. + + May be set to an epoch value if the release date is unknown. + """ + + display_name: str + """A human-readable name for the model.""" + + type: Literal["model"] + """Object type. + + For Models, this is always `"model"`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/model_list_params.py b/.venv/lib/python3.12/site-packages/anthropic/types/model_list_params.py new file mode 100644 index 00000000..b16d22a3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/model_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["ModelListParams"] + + +class ModelListParams(TypedDict, total=False): + after_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately after this object. + """ + + before_id: str + """ID of the object to use as a cursor for pagination. + + When provided, returns the page of results immediately before this object. + """ + + limit: int + """Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/model_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/model_param.py new file mode 100644 index 00000000..bce6f522 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/model_param.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, TypeAlias + +__all__ = ["ModelParam"] + +ModelParam: TypeAlias = Union[ + Literal[ + "claude-3-7-sonnet-latest", + "claude-3-7-sonnet-20250219", + "claude-3-5-haiku-latest", + "claude-3-5-haiku-20241022", + "claude-3-5-sonnet-latest", + "claude-3-5-sonnet-20241022", + "claude-3-5-sonnet-20240620", + "claude-3-opus-latest", + "claude-3-opus-20240229", + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2.1", + "claude-2.0", + ], + str, +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/plain_text_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/plain_text_source_param.py new file mode 100644 index 00000000..a2a3b8de --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/plain_text_source_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PlainTextSourceParam"] + + +class PlainTextSourceParam(TypedDict, total=False): + data: Required[str] + + media_type: Required[Literal["text/plain"]] + + type: Required[Literal["text"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_delta_event.py new file mode 100644 index 00000000..5bdbf09a --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_delta_event.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from .._utils import PropertyInfo +from .._models import BaseModel +from .text_delta import TextDelta +from .thinking_delta import ThinkingDelta +from .citations_delta import CitationsDelta +from .signature_delta import SignatureDelta +from .input_json_delta import InputJSONDelta + +__all__ = ["RawContentBlockDeltaEvent", "Delta"] + +Delta: TypeAlias = Annotated[ + Union[TextDelta, InputJSONDelta, CitationsDelta, ThinkingDelta, SignatureDelta], PropertyInfo(discriminator="type") +] + + +class RawContentBlockDeltaEvent(BaseModel): + delta: Delta + + index: int + + type: Literal["content_block_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_start_event.py new file mode 100644 index 00000000..bfbaa63d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_start_event.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Literal, Annotated, TypeAlias + +from .._utils import PropertyInfo +from .._models import BaseModel +from .text_block import TextBlock +from .thinking_block import ThinkingBlock +from .tool_use_block import ToolUseBlock +from .redacted_thinking_block import RedactedThinkingBlock + +__all__ = ["RawContentBlockStartEvent", "ContentBlock"] + +ContentBlock: TypeAlias = Annotated[ + Union[TextBlock, ToolUseBlock, ThinkingBlock, RedactedThinkingBlock], PropertyInfo(discriminator="type") +] + + +class RawContentBlockStartEvent(BaseModel): + content_block: ContentBlock + + index: int + + type: Literal["content_block_start"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_stop_event.py new file mode 100644 index 00000000..6241a8b2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_content_block_stop_event.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RawContentBlockStopEvent"] + + +class RawContentBlockStopEvent(BaseModel): + index: int + + type: Literal["content_block_stop"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_delta_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_delta_event.py new file mode 100644 index 00000000..3dae1e0d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_delta_event.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .message_delta_usage import MessageDeltaUsage + +__all__ = ["RawMessageDeltaEvent", "Delta"] + + +class Delta(BaseModel): + stop_reason: Optional[Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]] = None + + stop_sequence: Optional[str] = None + + +class RawMessageDeltaEvent(BaseModel): + delta: Delta + + type: Literal["message_delta"] + + usage: MessageDeltaUsage + """Billing and rate-limit usage. + + Anthropic's API bills and rate-limits by token counts, as tokens represent the + underlying cost to our systems. + + Under the hood, the API transforms requests into a format suitable for the + model. The model's output then goes through a parsing stage before becoming an + API response. As a result, the token counts in `usage` will not match one-to-one + with the exact visible content of an API request or response. + + For example, `output_tokens` will be non-zero, even for an empty string response + from Claude. + + Total input tokens in a request is the summation of `input_tokens`, + `cache_creation_input_tokens`, and `cache_read_input_tokens`. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_start_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_start_event.py new file mode 100644 index 00000000..1b9e8904 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_start_event.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .message import Message +from .._models import BaseModel + +__all__ = ["RawMessageStartEvent"] + + +class RawMessageStartEvent(BaseModel): + message: Message + + type: Literal["message_start"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stop_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stop_event.py new file mode 100644 index 00000000..d40ccfe2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stop_event.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RawMessageStopEvent"] + + +class RawMessageStopEvent(BaseModel): + type: Literal["message_stop"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stream_event.py b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stream_event.py new file mode 100644 index 00000000..728fbe88 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/raw_message_stream_event.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .raw_message_stop_event import RawMessageStopEvent +from .raw_message_delta_event import RawMessageDeltaEvent +from .raw_message_start_event import RawMessageStartEvent +from .raw_content_block_stop_event import RawContentBlockStopEvent +from .raw_content_block_delta_event import RawContentBlockDeltaEvent +from .raw_content_block_start_event import RawContentBlockStartEvent + +__all__ = ["RawMessageStreamEvent"] + +RawMessageStreamEvent: TypeAlias = Annotated[ + Union[ + RawMessageStartEvent, + RawMessageDeltaEvent, + RawMessageStopEvent, + RawContentBlockStartEvent, + RawContentBlockDeltaEvent, + RawContentBlockStopEvent, + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block.py new file mode 100644 index 00000000..4850b335 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RedactedThinkingBlock"] + + +class RedactedThinkingBlock(BaseModel): + data: str + + type: Literal["redacted_thinking"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block_param.py new file mode 100644 index 00000000..0933188c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/redacted_thinking_block_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["RedactedThinkingBlockParam"] + + +class RedactedThinkingBlockParam(TypedDict, total=False): + data: Required[str] + + type: Required[Literal["redacted_thinking"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/__init__.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/__init__.py new file mode 100644 index 00000000..178643b6 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/__init__.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .error_object import ErrorObject as ErrorObject +from .billing_error import BillingError as BillingError +from .error_response import ErrorResponse as ErrorResponse +from .not_found_error import NotFoundError as NotFoundError +from .api_error_object import APIErrorObject as APIErrorObject +from .overloaded_error import OverloadedError as OverloadedError +from .permission_error import PermissionError as PermissionError +from .rate_limit_error import RateLimitError as RateLimitError +from .authentication_error import AuthenticationError as AuthenticationError +from .gateway_timeout_error import GatewayTimeoutError as GatewayTimeoutError +from .invalid_request_error import InvalidRequestError as InvalidRequestError diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/api_error_object.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/api_error_object.py new file mode 100644 index 00000000..dd92bead --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/api_error_object.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["APIErrorObject"] + + +class APIErrorObject(BaseModel): + message: str + + type: Literal["api_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/authentication_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/authentication_error.py new file mode 100644 index 00000000..f777f5c8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/authentication_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["AuthenticationError"] + + +class AuthenticationError(BaseModel): + message: str + + type: Literal["authentication_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/billing_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/billing_error.py new file mode 100644 index 00000000..26be12bb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/billing_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["BillingError"] + + +class BillingError(BaseModel): + message: str + + type: Literal["billing_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_object.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_object.py new file mode 100644 index 00000000..086db503 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_object.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from ..._utils import PropertyInfo +from .billing_error import BillingError +from .not_found_error import NotFoundError +from .api_error_object import APIErrorObject +from .overloaded_error import OverloadedError +from .permission_error import PermissionError +from .rate_limit_error import RateLimitError +from .authentication_error import AuthenticationError +from .gateway_timeout_error import GatewayTimeoutError +from .invalid_request_error import InvalidRequestError + +__all__ = ["ErrorObject"] + +ErrorObject: TypeAlias = Annotated[ + Union[ + InvalidRequestError, + AuthenticationError, + BillingError, + PermissionError, + NotFoundError, + RateLimitError, + GatewayTimeoutError, + APIErrorObject, + OverloadedError, + ], + PropertyInfo(discriminator="type"), +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_response.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_response.py new file mode 100644 index 00000000..97034923 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/error_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel +from .error_object import ErrorObject + +__all__ = ["ErrorResponse"] + + +class ErrorResponse(BaseModel): + error: ErrorObject + + type: Literal["error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/gateway_timeout_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/gateway_timeout_error.py new file mode 100644 index 00000000..908aa12f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/gateway_timeout_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["GatewayTimeoutError"] + + +class GatewayTimeoutError(BaseModel): + message: str + + type: Literal["timeout_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/invalid_request_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/invalid_request_error.py new file mode 100644 index 00000000..ee5befc0 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/invalid_request_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["InvalidRequestError"] + + +class InvalidRequestError(BaseModel): + message: str + + type: Literal["invalid_request_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/not_found_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/not_found_error.py new file mode 100644 index 00000000..43e826fb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/not_found_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["NotFoundError"] + + +class NotFoundError(BaseModel): + message: str + + type: Literal["not_found_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/overloaded_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/overloaded_error.py new file mode 100644 index 00000000..74ee8373 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/overloaded_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["OverloadedError"] + + +class OverloadedError(BaseModel): + message: str + + type: Literal["overloaded_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/permission_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/permission_error.py new file mode 100644 index 00000000..48eb3546 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/permission_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PermissionError"] + + +class PermissionError(BaseModel): + message: str + + type: Literal["permission_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/shared/rate_limit_error.py b/.venv/lib/python3.12/site-packages/anthropic/types/shared/rate_limit_error.py new file mode 100644 index 00000000..3fa065ac --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/shared/rate_limit_error.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["RateLimitError"] + + +class RateLimitError(BaseModel): + message: str + + type: Literal["rate_limit_error"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/signature_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/signature_delta.py new file mode 100644 index 00000000..55d15189 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/signature_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["SignatureDelta"] + + +class SignatureDelta(BaseModel): + signature: str + + type: Literal["signature_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/text_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/text_block.py new file mode 100644 index 00000000..ecdddb69 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/text_block.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .text_citation import TextCitation + +__all__ = ["TextBlock"] + + +class TextBlock(BaseModel): + citations: Optional[List[TextCitation]] = None + """Citations supporting the text block. + + The type of citation returned will depend on the type of document being cited. + Citing a PDF results in `page_location`, plain text results in `char_location`, + and content document results in `content_block_location`. + """ + + text: str + + type: Literal["text"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/text_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/text_block_param.py new file mode 100644 index 00000000..92151733 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/text_block_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal, Required, TypedDict + +from .text_citation_param import TextCitationParam +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["TextBlockParam"] + + +class TextBlockParam(TypedDict, total=False): + text: Required[str] + + type: Required[Literal["text"]] + + cache_control: Optional[CacheControlEphemeralParam] + + citations: Optional[Iterable[TextCitationParam]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/text_citation.py b/.venv/lib/python3.12/site-packages/anthropic/types/text_citation.py new file mode 100644 index 00000000..159771ae --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/text_citation.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .citation_char_location import CitationCharLocation +from .citation_page_location import CitationPageLocation +from .citation_content_block_location import CitationContentBlockLocation + +__all__ = ["TextCitation"] + +TextCitation: TypeAlias = Annotated[ + Union[CitationCharLocation, CitationPageLocation, CitationContentBlockLocation], PropertyInfo(discriminator="type") +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/text_citation_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/text_citation_param.py new file mode 100644 index 00000000..8e988141 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/text_citation_param.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .citation_char_location_param import CitationCharLocationParam +from .citation_page_location_param import CitationPageLocationParam +from .citation_content_block_location_param import CitationContentBlockLocationParam + +__all__ = ["TextCitationParam"] + +TextCitationParam: TypeAlias = Union[ + CitationCharLocationParam, CitationPageLocationParam, CitationContentBlockLocationParam +] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/text_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/text_delta.py new file mode 100644 index 00000000..7ce96491 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/text_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["TextDelta"] + + +class TextDelta(BaseModel): + text: str + + type: Literal["text_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block.py new file mode 100644 index 00000000..7f98b500 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ThinkingBlock"] + + +class ThinkingBlock(BaseModel): + signature: str + + thinking: str + + type: Literal["thinking"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block_param.py new file mode 100644 index 00000000..d310c7f6 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_block_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ThinkingBlockParam"] + + +class ThinkingBlockParam(TypedDict, total=False): + signature: Required[str] + + thinking: Required[str] + + type: Required[Literal["thinking"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_disabled_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_disabled_param.py new file mode 100644 index 00000000..23b5fbad --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_disabled_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ThinkingConfigDisabledParam"] + + +class ThinkingConfigDisabledParam(TypedDict, total=False): + type: Required[Literal["disabled"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_enabled_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_enabled_param.py new file mode 100644 index 00000000..46b54892 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_enabled_param.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ThinkingConfigEnabledParam"] + + +class ThinkingConfigEnabledParam(TypedDict, total=False): + budget_tokens: Required[int] + """Determines how many tokens Claude can use for its internal reasoning process. + + Larger budgets can enable more thorough analysis for complex problems, improving + response quality. + + Must be ≥1024 and less than `max_tokens`. + + See + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) + for details. + """ + + type: Required[Literal["enabled"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_param.py new file mode 100644 index 00000000..0c1f9173 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_config_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .thinking_config_enabled_param import ThinkingConfigEnabledParam +from .thinking_config_disabled_param import ThinkingConfigDisabledParam + +__all__ = ["ThinkingConfigParam"] + +ThinkingConfigParam: TypeAlias = Union[ThinkingConfigEnabledParam, ThinkingConfigDisabledParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/thinking_delta.py b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_delta.py new file mode 100644 index 00000000..fb79933c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/thinking_delta.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ThinkingDelta"] + + +class ThinkingDelta(BaseModel): + thinking: str + + type: Literal["thinking_delta"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_bash_20250124_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_bash_20250124_param.py new file mode 100644 index 00000000..6c8ff0fc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_bash_20250124_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ToolBash20250124Param"] + + +class ToolBash20250124Param(TypedDict, total=False): + name: Required[Literal["bash"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["bash_20250124"]] + + cache_control: Optional[CacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_any_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_any_param.py new file mode 100644 index 00000000..a0a566ea --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_any_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ToolChoiceAnyParam"] + + +class ToolChoiceAnyParam(TypedDict, total=False): + type: Required[Literal["any"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_auto_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_auto_param.py new file mode 100644 index 00000000..456f675c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_auto_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ToolChoiceAutoParam"] + + +class ToolChoiceAutoParam(TypedDict, total=False): + type: Required[Literal["auto"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_none_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_none_param.py new file mode 100644 index 00000000..1e2e68a7 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_none_param.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ToolChoiceNoneParam"] + + +class ToolChoiceNoneParam(TypedDict, total=False): + type: Required[Literal["none"]] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_param.py new file mode 100644 index 00000000..868277d4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .tool_choice_any_param import ToolChoiceAnyParam +from .tool_choice_auto_param import ToolChoiceAutoParam +from .tool_choice_none_param import ToolChoiceNoneParam +from .tool_choice_tool_param import ToolChoiceToolParam + +__all__ = ["ToolChoiceParam"] + +ToolChoiceParam: TypeAlias = Union[ToolChoiceAutoParam, ToolChoiceAnyParam, ToolChoiceToolParam, ToolChoiceNoneParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_tool_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_tool_param.py new file mode 100644 index 00000000..aeec9966 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_choice_tool_param.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ToolChoiceToolParam"] + + +class ToolChoiceToolParam(TypedDict, total=False): + name: Required[str] + """The name of the tool to use.""" + + type: Required[Literal["tool"]] + + disable_parallel_tool_use: bool + """Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool + use. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_param.py new file mode 100644 index 00000000..a01a014e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_param.py @@ -0,0 +1,48 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .._models import set_pydantic_config +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ToolParam", "InputSchema"] + + +class InputSchemaTyped(TypedDict, total=False): + type: Required[Literal["object"]] + + properties: Optional[object] + + +set_pydantic_config(InputSchemaTyped, {"extra": "allow"}) + +InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]] + + +class ToolParam(TypedDict, total=False): + input_schema: Required[InputSchema] + """[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model + will produce. + """ + + name: Required[str] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + cache_control: Optional[CacheControlEphemeralParam] + + description: str + """Description of what this tool does. + + Tool descriptions should be as detailed as possible. The more information that + the model has about what the tool is and how to use it, the better it will + perform. You can use natural language descriptions to reinforce important + aspects of the tool input JSON schema. + """ diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_result_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_result_block_param.py new file mode 100644 index 00000000..b6ca8aa9 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_result_block_param.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .text_block_param import TextBlockParam +from .image_block_param import ImageBlockParam +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ToolResultBlockParam", "Content"] + +Content: TypeAlias = Union[TextBlockParam, ImageBlockParam] + + +class ToolResultBlockParam(TypedDict, total=False): + tool_use_id: Required[str] + + type: Required[Literal["tool_result"]] + + cache_control: Optional[CacheControlEphemeralParam] + + content: Union[str, Iterable[Content]] + + is_error: bool diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_text_editor_20250124_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_text_editor_20250124_param.py new file mode 100644 index 00000000..94f63102 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_text_editor_20250124_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ToolTextEditor20250124Param"] + + +class ToolTextEditor20250124Param(TypedDict, total=False): + name: Required[Literal["str_replace_editor"]] + """Name of the tool. + + This is how the tool will be called by the model and in tool_use blocks. + """ + + type: Required[Literal["text_editor_20250124"]] + + cache_control: Optional[CacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_union_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_union_param.py new file mode 100644 index 00000000..6c02090e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_union_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .tool_param import ToolParam +from .tool_bash_20250124_param import ToolBash20250124Param +from .tool_text_editor_20250124_param import ToolTextEditor20250124Param + +__all__ = ["ToolUnionParam"] + +ToolUnionParam: TypeAlias = Union[ToolParam, ToolBash20250124Param, ToolTextEditor20250124Param] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block.py new file mode 100644 index 00000000..05514471 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ToolUseBlock"] + + +class ToolUseBlock(BaseModel): + id: str + + input: object + + name: str + + type: Literal["tool_use"] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block_param.py new file mode 100644 index 00000000..cc285079 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/tool_use_block_param.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .cache_control_ephemeral_param import CacheControlEphemeralParam + +__all__ = ["ToolUseBlockParam"] + + +class ToolUseBlockParam(TypedDict, total=False): + id: Required[str] + + input: Required[object] + + name: Required[str] + + type: Required[Literal["tool_use"]] + + cache_control: Optional[CacheControlEphemeralParam] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/url_image_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/url_image_source_param.py new file mode 100644 index 00000000..852b8eee --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/url_image_source_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["URLImageSourceParam"] + + +class URLImageSourceParam(TypedDict, total=False): + type: Required[Literal["url"]] + + url: Required[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/url_pdf_source_param.py b/.venv/lib/python3.12/site-packages/anthropic/types/url_pdf_source_param.py new file mode 100644 index 00000000..b5321d56 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/url_pdf_source_param.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["URLPDFSourceParam"] + + +class URLPDFSourceParam(TypedDict, total=False): + type: Required[Literal["url"]] + + url: Required[str] diff --git a/.venv/lib/python3.12/site-packages/anthropic/types/usage.py b/.venv/lib/python3.12/site-packages/anthropic/types/usage.py new file mode 100644 index 00000000..b4f817bd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/anthropic/types/usage.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from .._models import BaseModel + +__all__ = ["Usage"] + + +class Usage(BaseModel): + cache_creation_input_tokens: Optional[int] = None + """The number of input tokens used to create the cache entry.""" + + cache_read_input_tokens: Optional[int] = None + """The number of input tokens read from the cache.""" + + input_tokens: int + """The number of input tokens which were used.""" + + output_tokens: int + """The number of output tokens which were used.""" |
