Skip to content
Closed
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
12 changes: 6 additions & 6 deletions src/anthropic/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __stream__(self) -> Iterator[_T]:
if sse.event == "completion":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if (
elif (
sse.event == "message_start"
or sse.event == "message_delta"
or sse.event == "message_stop"
Expand All @@ -100,10 +100,10 @@ def __stream__(self) -> Iterator[_T]:

yield process_data(data=data, cast_to=cast_to, response=response)

if sse.event == "ping":
elif sse.event == "ping":
continue

if sse.event == "error":
elif sse.event == "error":
body = sse.data

try:
Expand Down Expand Up @@ -206,7 +206,7 @@ async def __stream__(self) -> AsyncIterator[_T]:
if sse.event == "completion":
yield process_data(data=sse.json(), cast_to=cast_to, response=response)

if (
elif (
sse.event == "message_start"
or sse.event == "message_delta"
or sse.event == "message_stop"
Expand All @@ -221,10 +221,10 @@ async def __stream__(self) -> AsyncIterator[_T]:

yield process_data(data=data, cast_to=cast_to, response=response)

if sse.event == "ping":
elif sse.event == "ping":
continue

if sse.event == "error":
elif sse.event == "error":
body = sse.data

try:
Expand Down