Skip to content

Commit

Permalink
feat: add flexible enum to model param (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Jul 18, 2023
1 parent d9b7e30 commit e29b8f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/anthropic/resources/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, overload
from typing import List, Union, overload
from typing_extensions import Literal

from ..types import Completion, completion_create_params
Expand All @@ -21,7 +21,7 @@ def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
metadata: completion_create_params.CompletionRequestNonStreamingMetadata | NotGiven = NOT_GIVEN,
stop_sequences: List[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -113,7 +113,7 @@ def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
stream: Literal[True],
metadata: completion_create_params.CompletionRequestStreamingMetadata | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -205,7 +205,7 @@ def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
metadata: completion_create_params.CompletionRequestNonStreamingMetadata
| completion_create_params.CompletionRequestStreamingMetadata
Expand Down Expand Up @@ -253,7 +253,7 @@ async def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
metadata: completion_create_params.CompletionRequestNonStreamingMetadata | NotGiven = NOT_GIVEN,
stop_sequences: List[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -345,7 +345,7 @@ async def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
stream: Literal[True],
metadata: completion_create_params.CompletionRequestStreamingMetadata | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -437,7 +437,7 @@ async def create(
self,
*,
max_tokens_to_sample: int,
model: str,
model: Union[str, Literal["claude-2", "claude-instant-1"]],
prompt: str,
metadata: completion_create_params.CompletionRequestNonStreamingMetadata
| completion_create_params.CompletionRequestStreamingMetadata
Expand Down
4 changes: 2 additions & 2 deletions src/anthropic/types/completion_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CompletionRequestNonStreaming(TypedDict, total=False):
only specifies the absolute maximum number of tokens to generate.
"""

model: Required[str]
model: Required[Union[str, Literal["claude-2", "claude-instant-1"]]]
"""The model that will complete your prompt.
As we improve Claude, we develop new versions of it that you can query. This
Expand Down Expand Up @@ -109,7 +109,7 @@ class CompletionRequestStreaming(TypedDict, total=False):
only specifies the absolute maximum number of tokens to generate.
"""

model: Required[str]
model: Required[Union[str, Literal["claude-2", "claude-instant-1"]]]
"""The model that will complete your prompt.
As we improve Claude, we develop new versions of it that you can query. This
Expand Down

0 comments on commit e29b8f9

Please sign in to comment.