Skip to content

Commit 1d2510e

Browse files
Attempt quick fix
1 parent a46fef0 commit 1d2510e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/humanloop/prompts/raw_client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import contextlib
44
import datetime as dt
5+
import json
56
import typing
67
from json.decoder import JSONDecodeError
78

@@ -686,7 +687,13 @@ def _iter():
686687
if _sse.data == None:
687688
return
688689
try:
689-
yield _sse.data
690+
yield typing.cast(
691+
PromptCallStreamResponse,
692+
construct_type(
693+
type_=PromptCallStreamResponse, # type: ignore
694+
object_=json.loads(_sse.data),
695+
),
696+
)
690697
except Exception:
691698
pass
692699
return

tests/integration/test_prompts.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import json
2-
31
from humanloop.client import Humanloop
42

53
from tests.integration.conftest import TestIdentifiers
@@ -39,7 +37,6 @@ def test_prompts_call_stream(
3937
output = ""
4038
for chunk in response:
4139
assert chunk is not None
42-
chunk = json.loads(chunk)
4340
assert chunk.output is not None
4441
assert chunk.id is not None
4542
assert chunk.prompt_id is not None

0 commit comments

Comments
 (0)