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
  9f8cfa61_f82b_899e_e7b0_4af933553480["_beta_messages.py"]
  572af293_51f2_fb95_d24e_acc5aa707af1["572af293:51f2:fb95:d24e:acc5aa707af1"]
  9f8cfa61_f82b_899e_e7b0_4af933553480 --> 572af293_51f2_fb95_d24e_acc5aa707af1
  dcfeea51_e36b_f1d6_e3e7_7a8f2e20bf59["_compat"]
  9f8cfa61_f82b_899e_e7b0_4af933553480 --> dcfeea51_e36b_f1d6_e3e7_7a8f2e20bf59
  a1651524_5e9d_409a_c032_eb26963f0fc6["_resource"]
  9f8cfa61_f82b_899e_e7b0_4af933553480 --> a1651524_5e9d_409a_c032_eb26963f0fc6
  4d7c32e1_9b1d_4cd7_8d64_8b9512ba0cf8["_response"]
  9f8cfa61_f82b_899e_e7b0_4af933553480 --> 4d7c32e1_9b1d_4cd7_8d64_8b9512ba0cf8
  90317412_e4bb_842c_3cb8_ad1c1d3c2f8f["resources.beta"]
  9f8cfa61_f82b_899e_e7b0_4af933553480 --> 90317412_e4bb_842c_3cb8_ad1c1d3c2f8f
  fcb8b576_e5db_1acf_9312_20be91e2e300["_beta.py"]
  fcb8b576_e5db_1acf_9312_20be91e2e300 --> 9f8cfa61_f82b_899e_e7b0_4af933553480
  style 9f8cfa61_f82b_899e_e7b0_4af933553480 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

    @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

    @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

  • 572af293:51f2:fb95:d24e:acc5aa707af1
  • _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): 572af293:51f2:fb95:d24e:acc5aa707af1, _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/bedrock/_beta_messages.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic/lib/bedrock).

Analyze Your Own Codebase

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

Try Supermodel Free