-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cabe3fc
commit 1c2d817
Showing
3 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
from ..._compat import cached_property | ||
from ..._resource import SyncAPIResource, AsyncAPIResource | ||
from ._beta_messages import ( | ||
Messages, | ||
AsyncMessages, | ||
MessagesWithRawResponse, | ||
AsyncMessagesWithRawResponse, | ||
MessagesWithStreamingResponse, | ||
AsyncMessagesWithStreamingResponse, | ||
) | ||
|
||
__all__ = ["Beta", "AsyncBeta"] | ||
|
||
|
||
class Beta(SyncAPIResource): | ||
@cached_property | ||
def messages(self) -> Messages: | ||
return Messages(self._client) | ||
|
||
@cached_property | ||
def with_raw_response(self) -> BetaWithRawResponse: | ||
""" | ||
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 BetaWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> BetaWithStreamingResponse: | ||
""" | ||
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 BetaWithStreamingResponse(self) | ||
|
||
|
||
class AsyncBeta(AsyncAPIResource): | ||
@cached_property | ||
def messages(self) -> AsyncMessages: | ||
return AsyncMessages(self._client) | ||
|
||
@cached_property | ||
def with_raw_response(self) -> AsyncBetaWithRawResponse: | ||
""" | ||
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 AsyncBetaWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> AsyncBetaWithStreamingResponse: | ||
""" | ||
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 AsyncBetaWithStreamingResponse(self) | ||
|
||
|
||
class BetaWithRawResponse: | ||
def __init__(self, beta: Beta) -> None: | ||
self._beta = beta | ||
|
||
@cached_property | ||
def messages(self) -> MessagesWithRawResponse: | ||
return MessagesWithRawResponse(self._beta.messages) | ||
|
||
|
||
class AsyncBetaWithRawResponse: | ||
def __init__(self, beta: AsyncBeta) -> None: | ||
self._beta = beta | ||
|
||
@cached_property | ||
def messages(self) -> AsyncMessagesWithRawResponse: | ||
return AsyncMessagesWithRawResponse(self._beta.messages) | ||
|
||
|
||
class BetaWithStreamingResponse: | ||
def __init__(self, beta: Beta) -> None: | ||
self._beta = beta | ||
|
||
@cached_property | ||
def messages(self) -> MessagesWithStreamingResponse: | ||
return MessagesWithStreamingResponse(self._beta.messages) | ||
|
||
|
||
class AsyncBetaWithStreamingResponse: | ||
def __init__(self, beta: AsyncBeta) -> None: | ||
self._beta = beta | ||
|
||
@cached_property | ||
def messages(self) -> AsyncMessagesWithStreamingResponse: | ||
return AsyncMessagesWithStreamingResponse(self._beta.messages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# 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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters