Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): general availability updates #795

Merged
merged 1 commit into from
Dec 17, 2024
Merged
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
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-73443ebfebee64b8ec0ebbacd2521d6b6aa900e9526ec97abdcbcff0c0955d9b.yml
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic-be055148d227480fcacc9086c37ac8009dcb487731069ada51af35044f65bee4.yml
104 changes: 77 additions & 27 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# Shared Types

```python
from anthropic.types import (
APIErrorObject,
AuthenticationError,
BillingError,
ErrorObject,
ErrorResponse,
GatewayTimeoutError,
InvalidRequestError,
NotFoundError,
OverloadedError,
PermissionError,
RateLimitError,
)
```

# Messages

Types:

```python
from anthropic.types import (
Base64PDFSource,
CacheControlEphemeral,
ContentBlock,
ContentBlockDeltaEvent,
ContentBlockParam,
ContentBlockStartEvent,
ContentBlockStopEvent,
DocumentBlockParam,
ImageBlockParam,
InputJSONDelta,
Message,
Expand All @@ -18,6 +39,7 @@ from anthropic.types import (
MessageStartEvent,
MessageStopEvent,
MessageStreamEvent,
MessageTokensCount,
Metadata,
Model,
RawContentBlockDeltaEvent,
Expand All @@ -44,7 +66,46 @@ from anthropic.types import (

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 title="post /v1/messages">client.messages.<a href="./src/anthropic/resources/messages/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 title="post /v1/messages/count_tokens">client.messages.<a href="./src/anthropic/resources/messages/messages.py">count_tokens</a>(\*\*<a href="src/anthropic/types/message_count_tokens_params.py">params</a>) -> <a href="./src/anthropic/types/message_tokens_count.py">MessageTokensCount</a></code>

## Batches

Types:

```python
from anthropic.types.messages import (
MessageBatch,
MessageBatchCanceledResult,
MessageBatchErroredResult,
MessageBatchExpiredResult,
MessageBatchIndividualResponse,
MessageBatchRequestCounts,
MessageBatchResult,
MessageBatchSucceededResult,
)
```

Methods:

- <code title="post /v1/messages/batches">client.messages.batches.<a href="./src/anthropic/resources/messages/batches.py">create</a>(\*\*<a href="src/anthropic/types/messages/batch_create_params.py">params</a>) -> <a href="./src/anthropic/types/messages/message_batch.py">MessageBatch</a></code>
- <code title="get /v1/messages/batches/{message_batch_id}">client.messages.batches.<a href="./src/anthropic/resources/messages/batches.py">retrieve</a>(message_batch_id) -> <a href="./src/anthropic/types/messages/message_batch.py">MessageBatch</a></code>
- <code title="get /v1/messages/batches">client.messages.batches.<a href="./src/anthropic/resources/messages/batches.py">list</a>(\*\*<a href="src/anthropic/types/messages/batch_list_params.py">params</a>) -> <a href="./src/anthropic/types/messages/message_batch.py">SyncPage[MessageBatch]</a></code>
- <code title="post /v1/messages/batches/{message_batch_id}/cancel">client.messages.batches.<a href="./src/anthropic/resources/messages/batches.py">cancel</a>(message_batch_id) -> <a href="./src/anthropic/types/messages/message_batch.py">MessageBatch</a></code>
- <code title="get /v1/messages/batches/{message_batch_id}/results">client.messages.batches.<a href="./src/anthropic/resources/messages/batches.py">results</a>(message_batch_id) -> BinaryAPIResponse</code>

# Models

Types:

```python
from anthropic.types import ModelInfo
```

Methods:

- <code title="get /v1/models/{model_id}">client.models.<a href="./src/anthropic/resources/models.py">retrieve</a>(model_id) -> <a href="./src/anthropic/types/model_info.py">ModelInfo</a></code>
- <code title="get /v1/models">client.models.<a href="./src/anthropic/resources/models.py">list</a>(\*\*<a href="src/anthropic/types/model_list_params.py">params</a>) -> <a href="./src/anthropic/types/model_info.py">SyncPage[ModelInfo]</a></code>

# Beta

Expand All @@ -55,8 +116,10 @@ from anthropic.types import (
AnthropicBeta,
BetaAPIError,
BetaAuthenticationError,
BetaBillingError,
BetaError,
BetaErrorResponse,
BetaGatewayTimeoutError,
BetaInvalidRequestError,
BetaNotFoundError,
BetaOverloadedError,
Expand All @@ -65,6 +128,19 @@ from anthropic.types import (
)
```

## Models

Types:

```python
from anthropic.types.beta import BetaModelInfo
```

Methods:

- <code title="get /v1/models/{model_id}?beta=true">client.beta.models.<a href="./src/anthropic/resources/beta/models.py">retrieve</a>(model_id) -> <a href="./src/anthropic/types/beta/beta_model_info.py">BetaModelInfo</a></code>
- <code title="get /v1/models?beta=true">client.beta.models.<a href="./src/anthropic/resources/beta/models.py">list</a>(\*\*<a href="src/anthropic/types/beta/model_list_params.py">params</a>) -> <a href="./src/anthropic/types/beta/beta_model_info.py">SyncPage[BetaModelInfo]</a></code>

## Messages

Types:
Expand Down Expand Up @@ -138,29 +214,3 @@ Methods:
- <code title="get /v1/messages/batches?beta=true">client.beta.messages.batches.<a href="./src/anthropic/resources/beta/messages/batches.py">list</a>(\*\*<a href="src/anthropic/types/beta/messages/batch_list_params.py">params</a>) -> <a href="./src/anthropic/types/beta/messages/beta_message_batch.py">SyncPage[BetaMessageBatch]</a></code>
- <code title="post /v1/messages/batches/{message_batch_id}/cancel?beta=true">client.beta.messages.batches.<a href="./src/anthropic/resources/beta/messages/batches.py">cancel</a>(message_batch_id) -> <a href="./src/anthropic/types/beta/messages/beta_message_batch.py">BetaMessageBatch</a></code>
- <code title="get /v1/messages/batches/{message_batch_id}/results?beta=true">client.beta.messages.batches.<a href="./src/anthropic/resources/beta/messages/batches.py">results</a>(message_batch_id) -> BinaryAPIResponse</code>

## PromptCaching

### Messages

Types:

```python
from anthropic.types.beta.prompt_caching import (
PromptCachingBetaCacheControlEphemeral,
PromptCachingBetaImageBlockParam,
PromptCachingBetaMessage,
PromptCachingBetaMessageParam,
PromptCachingBetaTextBlockParam,
PromptCachingBetaTool,
PromptCachingBetaToolResultBlockParam,
PromptCachingBetaToolUseBlockParam,
PromptCachingBetaUsage,
RawPromptCachingBetaMessageStartEvent,
RawPromptCachingBetaMessageStreamEvent,
)
```

Methods:

- <code title="post /v1/messages?beta=prompt_caching">client.beta.prompt_caching.messages.<a href="./src/anthropic/resources/beta/prompt_caching/messages.py">create</a>(\*\*<a href="src/anthropic/types/beta/prompt_caching/message_create_params.py">params</a>) -> <a href="./src/anthropic/types/beta/prompt_caching/prompt_caching_beta_message.py">PromptCachingBetaMessage</a></code>
11 changes: 10 additions & 1 deletion src/anthropic/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
get_async_library,
)
from ._version import __version__
from .resources import messages, completions
from .resources import models, completions
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError
from ._base_client import (
Expand All @@ -34,6 +34,7 @@
AsyncAPIClient,
)
from .resources.beta import beta
from .resources.messages import messages

__all__ = [
"Timeout",
Expand All @@ -50,6 +51,7 @@
class Anthropic(SyncAPIClient):
completions: completions.Completions
messages: messages.Messages
models: models.Models
beta: beta.Beta
with_raw_response: AnthropicWithRawResponse
with_streaming_response: AnthropicWithStreamedResponse
Expand Down Expand Up @@ -120,6 +122,7 @@ def __init__(

self.completions = completions.Completions(self)
self.messages = messages.Messages(self)
self.models = models.Models(self)
self.beta = beta.Beta(self)
self.with_raw_response = AnthropicWithRawResponse(self)
self.with_streaming_response = AnthropicWithStreamedResponse(self)
Expand Down Expand Up @@ -268,6 +271,7 @@ def _make_status_error(
class AsyncAnthropic(AsyncAPIClient):
completions: completions.AsyncCompletions
messages: messages.AsyncMessages
models: models.AsyncModels
beta: beta.AsyncBeta
with_raw_response: AsyncAnthropicWithRawResponse
with_streaming_response: AsyncAnthropicWithStreamedResponse
Expand Down Expand Up @@ -338,6 +342,7 @@ def __init__(

self.completions = completions.AsyncCompletions(self)
self.messages = messages.AsyncMessages(self)
self.models = models.AsyncModels(self)
self.beta = beta.AsyncBeta(self)
self.with_raw_response = AsyncAnthropicWithRawResponse(self)
self.with_streaming_response = AsyncAnthropicWithStreamedResponse(self)
Expand Down Expand Up @@ -487,27 +492,31 @@ class AnthropicWithRawResponse:
def __init__(self, client: Anthropic) -> None:
self.completions = completions.CompletionsWithRawResponse(client.completions)
self.messages = messages.MessagesWithRawResponse(client.messages)
self.models = models.ModelsWithRawResponse(client.models)
self.beta = beta.BetaWithRawResponse(client.beta)


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


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


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


Expand Down
14 changes: 14 additions & 0 deletions src/anthropic/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
BetaWithStreamingResponse,
AsyncBetaWithStreamingResponse,
)
from .models import (
Models,
AsyncModels,
ModelsWithRawResponse,
AsyncModelsWithRawResponse,
ModelsWithStreamingResponse,
AsyncModelsWithStreamingResponse,
)
from .messages import (
Messages,
AsyncMessages,
Expand Down Expand Up @@ -38,6 +46,12 @@
"AsyncMessagesWithRawResponse",
"MessagesWithStreamingResponse",
"AsyncMessagesWithStreamingResponse",
"Models",
"AsyncModels",
"ModelsWithRawResponse",
"AsyncModelsWithRawResponse",
"ModelsWithStreamingResponse",
"AsyncModelsWithStreamingResponse",
"Beta",
"AsyncBeta",
"BetaWithRawResponse",
Expand Down
28 changes: 14 additions & 14 deletions src/anthropic/resources/beta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
BetaWithStreamingResponse,
AsyncBetaWithStreamingResponse,
)
from .models import (
Models,
AsyncModels,
ModelsWithRawResponse,
AsyncModelsWithRawResponse,
ModelsWithStreamingResponse,
AsyncModelsWithStreamingResponse,
)
from .messages import (
Messages,
AsyncMessages,
Expand All @@ -16,28 +24,20 @@
MessagesWithStreamingResponse,
AsyncMessagesWithStreamingResponse,
)
from .prompt_caching import (
PromptCaching,
AsyncPromptCaching,
PromptCachingWithRawResponse,
AsyncPromptCachingWithRawResponse,
PromptCachingWithStreamingResponse,
AsyncPromptCachingWithStreamingResponse,
)

__all__ = [
"Models",
"AsyncModels",
"ModelsWithRawResponse",
"AsyncModelsWithRawResponse",
"ModelsWithStreamingResponse",
"AsyncModelsWithStreamingResponse",
"Messages",
"AsyncMessages",
"MessagesWithRawResponse",
"AsyncMessagesWithRawResponse",
"MessagesWithStreamingResponse",
"AsyncMessagesWithStreamingResponse",
"PromptCaching",
"AsyncPromptCaching",
"PromptCachingWithRawResponse",
"AsyncPromptCachingWithRawResponse",
"PromptCachingWithStreamingResponse",
"AsyncPromptCachingWithStreamingResponse",
"Beta",
"AsyncBeta",
"BetaWithRawResponse",
Expand Down
Loading