Home / File/ _beta_messages.py — anthropic-sdk-python Source File

_beta_messages.py — anthropic-sdk-python Source File

Architecture documentation for _beta_messages.py, a python file in the anthropic-sdk-python codebase. 5 imports, 1 dependents.

File python AnthropicClient SyncAPI 5 imports 1 dependents 6 classes

Entity Profile

Dependency Diagram

graph LR
  b4641bb5_9dee_e780_9e9c_66a8c11b2481["_beta_messages.py"]
  7af3d6da_76a3_56bc_2699_acdf9f99885d["7af3d6da:76a3:56bc:2699:acdf9f99885d"]
  b4641bb5_9dee_e780_9e9c_66a8c11b2481 --> 7af3d6da_76a3_56bc_2699_acdf9f99885d
  7b9571c7_f3c7_9081_747d_05b632f1a3e2["_compat"]
  b4641bb5_9dee_e780_9e9c_66a8c11b2481 --> 7b9571c7_f3c7_9081_747d_05b632f1a3e2
  69d5d154_63ab_8b70_9a76_075f3a4f6ed3["_resource"]
  b4641bb5_9dee_e780_9e9c_66a8c11b2481 --> 69d5d154_63ab_8b70_9a76_075f3a4f6ed3
  63880f26_771e_c8de_e950_64b0c288c1a9["_response"]
  b4641bb5_9dee_e780_9e9c_66a8c11b2481 --> 63880f26_771e_c8de_e950_64b0c288c1a9
  d14a1281_0a63_25fc_1dce_c654af95f7c5["resources.beta"]
  b4641bb5_9dee_e780_9e9c_66a8c11b2481 --> d14a1281_0a63_25fc_1dce_c654af95f7c5
  c67615a5_6c22_f3a8_22e6_6badfeba0703["_beta.py"]
  c67615a5_6c22_f3a8_22e6_6badfeba0703 --> b4641bb5_9dee_e780_9e9c_66a8c11b2481
  style b4641bb5_9dee_e780_9e9c_66a8c11b2481 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from ... import _legacy_response
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...resources.beta import Messages as FirstPartyMessagesAPI, AsyncMessages as FirstPartyAsyncMessagesAPI

__all__ = ["Messages", "AsyncMessages"]


class Messages(SyncAPIResource):
    create = FirstPartyMessagesAPI.create
    stream = FirstPartyMessagesAPI.stream
    count_tokens = FirstPartyMessagesAPI.count_tokens

    @cached_property
    def with_raw_response(self) -> MessagesWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return the
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        """
        return MessagesWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> MessagesWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        """
        return MessagesWithStreamingResponse(self)


class AsyncMessages(AsyncAPIResource):
    create = FirstPartyAsyncMessagesAPI.create
    stream = FirstPartyAsyncMessagesAPI.stream
    count_tokens = FirstPartyAsyncMessagesAPI.count_tokens

    @cached_property
    def with_raw_response(self) -> AsyncMessagesWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return the
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
        """
        return AsyncMessagesWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncMessagesWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
        """
        return AsyncMessagesWithStreamingResponse(self)


class MessagesWithRawResponse:
    def __init__(self, messages: Messages) -> None:
        self._messages = messages

        self.create = _legacy_response.to_raw_response_wrapper(
            messages.create,
        )


class AsyncMessagesWithRawResponse:
    def __init__(self, messages: AsyncMessages) -> None:
        self._messages = messages

        self.create = _legacy_response.async_to_raw_response_wrapper(
            messages.create,
        )


class MessagesWithStreamingResponse:
    def __init__(self, messages: Messages) -> None:
        self._messages = messages

        self.create = to_streamed_response_wrapper(
            messages.create,
        )


class AsyncMessagesWithStreamingResponse:
    def __init__(self, messages: AsyncMessages) -> None:
        self._messages = messages

        self.create = async_to_streamed_response_wrapper(
            messages.create,
        )

Subdomains

Dependencies

  • 7af3d6da:76a3:56bc:2699:acdf9f99885d
  • _compat
  • _resource
  • _response
  • resources.beta

Frequently Asked Questions

What does _beta_messages.py do?
_beta_messages.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What does _beta_messages.py depend on?
_beta_messages.py imports 5 module(s): 7af3d6da:76a3:56bc:2699:acdf9f99885d, _compat, _resource, _response, resources.beta.
What files import _beta_messages.py?
_beta_messages.py is imported by 1 file(s): _beta.py.
Where is _beta_messages.py in the architecture?
_beta_messages.py is located at src/anthropic/lib/vertex/_beta_messages.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic/lib/vertex).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free