Skip to content

Commit

Permalink
feat(api): tool use is GA and available on 3P (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed May 30, 2024
1 parent 7526bf0 commit ad7adbd
Show file tree
Hide file tree
Showing 40 changed files with 824 additions and 3,441 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-11e9f674e1fe0eb85a713c2852de663254d4e9254dea701008dcd605a04987d5.yml
configured_endpoints: 2
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-4f6df1026ffeed840bbfada906ac51144508d1e1b099084c593aa9bac97a3362.yml
35 changes: 4 additions & 31 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from anthropic.types import (
ContentBlockStartEvent,
ContentBlockStopEvent,
ImageBlockParam,
InputJsonDelta,
Message,
MessageDeltaEvent,
MessageDeltaUsage,
Expand All @@ -26,43 +27,15 @@ from anthropic.types import (
TextBlock,
TextBlockParam,
TextDelta,
Usage,
)
```

Methods:

- <code title="post /v1/messages">client.messages.<a href="./src/anthropic/resources/messages.py">create</a>(\*\*<a href="src/anthropic/types/message_create_params.py">params</a>) -> <a href="./src/anthropic/types/message.py">Message</a></code>
- <code>client.messages.<a href="./src/anthropic/resources/messages.py">stream</a>(\*args) -> MessageStreamManager[MessageStream] | MessageStreamManager[MessageStreamT]</code>

# Beta

## Tools

### Messages

Types:

```python
from anthropic.types.beta.tools import (
InputJsonDelta,
RawToolsBetaContentBlockDeltaEvent,
RawToolsBetaContentBlockStartEvent,
RawToolsBetaMessageStreamEvent,
Tool,
ToolResultBlockParam,
ToolUseBlock,
ToolUseBlockParam,
ToolsBetaContentBlock,
ToolsBetaContentBlockDeltaEvent,
ToolsBetaContentBlockStartEvent,
ToolsBetaMessage,
ToolsBetaMessageParam,
ToolsBetaMessageStreamEvent,
Usage,
)
```

Methods:

- <code title="post /v1/messages?beta=tools">client.beta.tools.messages.<a href="./src/anthropic/resources/beta/tools/messages.py">create</a>(\*\*<a href="src/anthropic/types/beta/tools/message_create_params.py">params</a>) -> <a href="./src/anthropic/types/beta/tools/tools_beta_message.py">ToolsBetaMessage</a></code>
- <code>client.beta.tools.messages.<a href="./src/anthropic/resources/beta/tools/messages.py">stream</a>(\*args) -> ToolsBetaMessageStreamManager[ToolsBetaMessageStream] | ToolsBetaMessageStreamManager[ToolsBetaMessageStreamT]</code>
- <code title="post /v1/messages">client.messages.<a href="./src/anthropic/resources/messages.py">create</a>(\*\*<a href="src/anthropic/types/message_create_params.py">params</a>) -> <a href="./src/anthropic/types/message.py">Message</a></code>
- <code>client.messages.<a href="./src/anthropic/resources/messages.py">stream</a>(\*args) -> MessageStreamManager[MessageStream] | MessageStreamManager[MessageStreamT]</code>
8 changes: 0 additions & 8 deletions src/anthropic/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
class Anthropic(SyncAPIClient):
completions: resources.Completions
messages: resources.Messages
beta: resources.Beta
with_raw_response: AnthropicWithRawResponse
with_streaming_response: AnthropicWithStreamedResponse

Expand Down Expand Up @@ -137,7 +136,6 @@ def __init__(

self.completions = resources.Completions(self)
self.messages = resources.Messages(self)
self.beta = resources.Beta(self)
self.with_raw_response = AnthropicWithRawResponse(self)
self.with_streaming_response = AnthropicWithStreamedResponse(self)

Expand Down Expand Up @@ -322,7 +320,6 @@ def _make_status_error(
class AsyncAnthropic(AsyncAPIClient):
completions: resources.AsyncCompletions
messages: resources.AsyncMessages
beta: resources.AsyncBeta
with_raw_response: AsyncAnthropicWithRawResponse
with_streaming_response: AsyncAnthropicWithStreamedResponse

Expand Down Expand Up @@ -401,7 +398,6 @@ def __init__(

self.completions = resources.AsyncCompletions(self)
self.messages = resources.AsyncMessages(self)
self.beta = resources.AsyncBeta(self)
self.with_raw_response = AsyncAnthropicWithRawResponse(self)
self.with_streaming_response = AsyncAnthropicWithStreamedResponse(self)

Expand Down Expand Up @@ -587,28 +583,24 @@ class AnthropicWithRawResponse:
def __init__(self, client: Anthropic) -> None:
self.completions = resources.CompletionsWithRawResponse(client.completions)
self.messages = resources.MessagesWithRawResponse(client.messages)
self.beta = resources.BetaWithRawResponse(client.beta)


class AsyncAnthropicWithRawResponse:
def __init__(self, client: AsyncAnthropic) -> None:
self.completions = resources.AsyncCompletionsWithRawResponse(client.completions)
self.messages = resources.AsyncMessagesWithRawResponse(client.messages)
self.beta = resources.AsyncBetaWithRawResponse(client.beta)


class AnthropicWithStreamedResponse:
def __init__(self, client: Anthropic) -> None:
self.completions = resources.CompletionsWithStreamingResponse(client.completions)
self.messages = resources.MessagesWithStreamingResponse(client.messages)
self.beta = resources.BetaWithStreamingResponse(client.beta)


class AsyncAnthropicWithStreamedResponse:
def __init__(self, client: AsyncAnthropic) -> None:
self.completions = resources.AsyncCompletionsWithStreamingResponse(client.completions)
self.messages = resources.AsyncMessagesWithStreamingResponse(client.messages)
self.beta = resources.AsyncBetaWithStreamingResponse(client.beta)


Client = Anthropic
Expand Down
14 changes: 0 additions & 14 deletions src/anthropic/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .beta import (
Beta,
AsyncBeta,
BetaWithRawResponse,
AsyncBetaWithRawResponse,
BetaWithStreamingResponse,
AsyncBetaWithStreamingResponse,
)
from .messages import (
Messages,
AsyncMessages,
Expand Down Expand Up @@ -38,10 +30,4 @@
"AsyncMessagesWithRawResponse",
"MessagesWithStreamingResponse",
"AsyncMessagesWithStreamingResponse",
"Beta",
"AsyncBeta",
"BetaWithRawResponse",
"AsyncBetaWithRawResponse",
"BetaWithStreamingResponse",
"AsyncBetaWithStreamingResponse",
]
33 changes: 0 additions & 33 deletions src/anthropic/resources/beta/__init__.py

This file was deleted.

81 changes: 0 additions & 81 deletions src/anthropic/resources/beta/beta.py

This file was deleted.

33 changes: 0 additions & 33 deletions src/anthropic/resources/beta/tools/__init__.py

This file was deleted.

Loading

0 comments on commit ad7adbd

Please sign in to comment.