Skip to content

Commit 4440a04

Browse files
committed
Fix pydantic issue in test
1 parent 087f8a7 commit 4440a04

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

sentry_sdk/integrations/openai.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ def new_chat_completion(*args, **kwargs):
146146
elif hasattr(res, "_iterator"):
147147
data_buf: list[list[str]] = [] # one for each choice
148148

149-
# type: Iterator[ChatCompletionChunk]
150-
old_iterator = res._iterator
149+
old_iterator = res._iterator # type: Iterator[ChatCompletionChunk]
151150

152151
def new_iterator():
153152
# type: () -> Iterator[ChatCompletionChunk]

tests/integrations/openai/test_openai.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,22 @@ def test_streaming_chat_completion(sentry_init, capture_events):
7373
returned_stream._iterator = [
7474
ChatCompletionChunk(
7575
id="1",
76-
choices=[DeltaChoice(index=0, delta=ChoiceDelta(content="hel"))],
76+
choices=[
77+
DeltaChoice(
78+
index=0, delta=ChoiceDelta(content="hel"), finish_reason=None
79+
)
80+
],
7781
created=100000,
7882
model="model-id",
7983
object="chat.completion.chunk",
8084
),
8185
ChatCompletionChunk(
8286
id="1",
83-
choices=[DeltaChoice(index=1, delta=ChoiceDelta(content="lo "))],
87+
choices=[
88+
DeltaChoice(
89+
index=1, delta=ChoiceDelta(content="lo "), finish_reason=None
90+
)
91+
],
8492
created=100000,
8593
model="model-id",
8694
object="chat.completion.chunk",

0 commit comments

Comments
 (0)