Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/anthropic/lib/bedrock/_beta_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

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

@cached_property
def with_raw_response(self) -> MessagesWithRawResponse:
Expand All @@ -36,6 +40,10 @@ def with_streaming_response(self) -> MessagesWithStreamingResponse:

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

@cached_property
def with_raw_response(self) -> AsyncMessagesWithRawResponse:
Expand Down Expand Up @@ -64,6 +72,12 @@ def __init__(self, messages: Messages) -> None:
self.create = _legacy_response.to_raw_response_wrapper(
messages.create,
)
self.count_tokens = _legacy_response.to_raw_response_wrapper(
messages.count_tokens,
)
self.parse = _legacy_response.to_raw_response_wrapper(
messages.parse,
)


class AsyncMessagesWithRawResponse:
Expand All @@ -73,6 +87,12 @@ def __init__(self, messages: AsyncMessages) -> None:
self.create = _legacy_response.async_to_raw_response_wrapper(
messages.create,
)
self.count_tokens = _legacy_response.async_to_raw_response_wrapper(
messages.count_tokens,
)
self.parse = _legacy_response.async_to_raw_response_wrapper(
messages.parse,
)


class MessagesWithStreamingResponse:
Expand All @@ -82,6 +102,12 @@ def __init__(self, messages: Messages) -> None:
self.create = to_streamed_response_wrapper(
messages.create,
)
self.count_tokens = to_streamed_response_wrapper(
messages.count_tokens,
)
self.parse = to_streamed_response_wrapper(
messages.parse,
)


class AsyncMessagesWithStreamingResponse:
Expand All @@ -91,3 +117,9 @@ def __init__(self, messages: AsyncMessages) -> None:
self.create = async_to_streamed_response_wrapper(
messages.create,
)
self.count_tokens = async_to_streamed_response_wrapper(
messages.count_tokens,
)
self.parse = async_to_streamed_response_wrapper(
messages.parse,
)
28 changes: 28 additions & 0 deletions src/anthropic/lib/vertex/_beta_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Messages(SyncAPIResource):
create = FirstPartyMessagesAPI.create
stream = FirstPartyMessagesAPI.stream
count_tokens = FirstPartyMessagesAPI.count_tokens
parse = FirstPartyMessagesAPI.parse
tool_runner = FirstPartyMessagesAPI.tool_runner

@cached_property
def with_raw_response(self) -> MessagesWithRawResponse:
Expand All @@ -40,6 +42,8 @@ class AsyncMessages(AsyncAPIResource):
create = FirstPartyAsyncMessagesAPI.create
stream = FirstPartyAsyncMessagesAPI.stream
count_tokens = FirstPartyAsyncMessagesAPI.count_tokens
parse = FirstPartyAsyncMessagesAPI.parse
tool_runner = FirstPartyAsyncMessagesAPI.tool_runner

@cached_property
def with_raw_response(self) -> AsyncMessagesWithRawResponse:
Expand Down Expand Up @@ -68,6 +72,12 @@ def __init__(self, messages: Messages) -> None:
self.create = _legacy_response.to_raw_response_wrapper(
messages.create,
)
self.count_tokens = _legacy_response.to_raw_response_wrapper(
messages.count_tokens,
)
self.parse = _legacy_response.to_raw_response_wrapper(
messages.parse,
)


class AsyncMessagesWithRawResponse:
Expand All @@ -77,6 +87,12 @@ def __init__(self, messages: AsyncMessages) -> None:
self.create = _legacy_response.async_to_raw_response_wrapper(
messages.create,
)
self.count_tokens = _legacy_response.async_to_raw_response_wrapper(
messages.count_tokens,
)
self.parse = _legacy_response.async_to_raw_response_wrapper(
messages.parse,
)


class MessagesWithStreamingResponse:
Expand All @@ -86,6 +102,12 @@ def __init__(self, messages: Messages) -> None:
self.create = to_streamed_response_wrapper(
messages.create,
)
self.count_tokens = to_streamed_response_wrapper(
messages.count_tokens,
)
self.parse = to_streamed_response_wrapper(
messages.parse,
)


class AsyncMessagesWithStreamingResponse:
Expand All @@ -95,3 +117,9 @@ def __init__(self, messages: AsyncMessages) -> None:
self.create = async_to_streamed_response_wrapper(
messages.create,
)
self.count_tokens = async_to_streamed_response_wrapper(
messages.count_tokens,
)
self.parse = async_to_streamed_response_wrapper(
messages.parse,
)