Debian Codegraph @

src/anthropic/lib/bedrock/_beta.py

raw
1 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3 from __future__ import annotations
4
5 from ..._compat import cached_property
6 from ..._resource import SyncAPIResource, AsyncAPIResource
7 from ._beta_messages import (
8 Messages,
9 AsyncMessages,
10 MessagesWithRawResponse,
11 AsyncMessagesWithRawResponse,
12 MessagesWithStreamingResponse,
13 AsyncMessagesWithStreamingResponse,
14 )
15
16 __all__ = ["Beta", "AsyncBeta"]
17
18
19 class Beta(SyncAPIResource):
20 @cached_property
21 def messages(self) -> Messages:
22 return Messages(self._client)
23
24 @cached_property
25 def with_raw_response(self) -> BetaWithRawResponse:
26 """
27 This property can be used as a prefix for any HTTP method call to return the
28 the raw response object instead of the parsed content.
29
30 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
31 """
32 return BetaWithRawResponse(self)
33
34 @cached_property
35 def with_streaming_response(self) -> BetaWithStreamingResponse:
36 """
37 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
39 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
40 """
41 return BetaWithStreamingResponse(self)
42
43
44 class AsyncBeta(AsyncAPIResource):
45 @cached_property
46 def messages(self) -> AsyncMessages:
47 return AsyncMessages(self._client)
48
49 @cached_property
50 def with_raw_response(self) -> AsyncBetaWithRawResponse:
51 """
52 This property can be used as a prefix for any HTTP method call to return the
53 the raw response object instead of the parsed content.
54
55 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
56 """
57 return AsyncBetaWithRawResponse(self)
58
59 @cached_property
60 def with_streaming_response(self) -> AsyncBetaWithStreamingResponse:
61 """
62 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
64 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
65 """
66 return AsyncBetaWithStreamingResponse(self)
67
68
69 class BetaWithRawResponse:
70 def __init__(self, beta: Beta) -> None:
71 self._beta = beta
72
73 @cached_property
74 def messages(self) -> MessagesWithRawResponse:
75 return MessagesWithRawResponse(self._beta.messages)
76
77
78 class AsyncBetaWithRawResponse:
79 def __init__(self, beta: AsyncBeta) -> None:
80 self._beta = beta
81
82 @cached_property
83 def messages(self) -> AsyncMessagesWithRawResponse:
84 return AsyncMessagesWithRawResponse(self._beta.messages)
85
86
87 class BetaWithStreamingResponse:
88 def __init__(self, beta: Beta) -> None:
89 self._beta = beta
90
91 @cached_property
92 def messages(self) -> MessagesWithStreamingResponse:
93 return MessagesWithStreamingResponse(self._beta.messages)
94
95
96 class AsyncBetaWithStreamingResponse:
97 def __init__(self, beta: AsyncBeta) -> None:
98 self._beta = beta
99
100 @cached_property
101 def messages(self) -> AsyncMessagesWithStreamingResponse:
102 return AsyncMessagesWithStreamingResponse(self._beta.messages)