Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c9eb11b

Browse files
committedJul 24, 2024·
fix: change signatures for the stream function
1 parent 25a5b6c commit c9eb11b

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed
 

‎src/anthropic/_utils/_reflection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def assert_signatures_in_sync(
3434

3535
if custom_param.annotation != source_param.annotation:
3636
errors.append(
37-
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}"
37+
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}"
3838
)
3939
continue
4040

‎src/anthropic/resources/messages.py

+2-24
Original file line numberDiff line numberDiff line change
@@ -885,18 +885,7 @@ def stream(
885885
*,
886886
max_tokens: int,
887887
messages: Iterable[MessageParam],
888-
model: Union[
889-
str,
890-
Literal[
891-
"claude-3-5-sonnet-20240620",
892-
"claude-3-opus-20240229",
893-
"claude-3-sonnet-20240229",
894-
"claude-3-haiku-20240307",
895-
"claude-2.1",
896-
"claude-2.0",
897-
"claude-instant-1.2",
898-
],
899-
],
888+
model: ModelParam,
900889
metadata: message_create_params.Metadata | NotGiven = NOT_GIVEN,
901890
stop_sequences: List[str] | NotGiven = NOT_GIVEN,
902891
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,
@@ -1800,18 +1789,7 @@ def stream(
18001789
*,
18011790
max_tokens: int,
18021791
messages: Iterable[MessageParam],
1803-
model: Union[
1804-
str,
1805-
Literal[
1806-
"claude-3-5-sonnet-20240620",
1807-
"claude-3-opus-20240229",
1808-
"claude-3-sonnet-20240229",
1809-
"claude-3-haiku-20240307",
1810-
"claude-2.1",
1811-
"claude-2.0",
1812-
"claude-instant-1.2",
1813-
],
1814-
],
1792+
model: ModelParam,
18151793
metadata: message_create_params.Metadata | NotGiven = NOT_GIVEN,
18161794
stop_sequences: List[str] | NotGiven = NOT_GIVEN,
18171795
system: Union[str, Iterable[TextBlockParam]] | NotGiven = NOT_GIVEN,

‎tests/lib/streaming/test_messages.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_stream_method_definition_in_sync(sync: bool) -> None:
192192

193193
if custom_param.annotation != generated_param.annotation:
194194
errors.append(
195-
f"types for the `{name}` param are do not match; generated={repr(generated_param.annotation)} custom={repr(generated_param.annotation)}"
195+
f"types for the `{name}` param are do not match; generated={repr(generated_param.annotation)} custom={repr(custom_param.annotation)}"
196196
)
197197
continue
198198

0 commit comments

Comments
 (0)
Please sign in to comment.