Skip to content

Commit b9e9e9c

Browse files
committed
fix: test
1 parent b9ac3cc commit b9e9e9c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

posthog/ai/openai/openai_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def create(
5050
posthog_trace_id = uuid.uuid4()
5151

5252
if kwargs.get("stream", False):
53-
return self._create_streaming(
53+
return await self._create_streaming(
5454
posthog_distinct_id,
5555
posthog_trace_id,
5656
posthog_properties,
@@ -84,14 +84,14 @@ async def _create_streaming(
8484
start_time = time.time()
8585
usage_stats: Dict[str, int] = {}
8686
final_content = []
87-
response = super().create(**kwargs)
87+
response = await super().create(**kwargs)
8888

8989
async def async_generator():
9090
nonlocal usage_stats
9191
nonlocal final_content
9292

9393
try:
94-
for chunk in response:
94+
async for chunk in response:
9595
if hasattr(chunk, "type") and chunk.type == "response.completed":
9696
res = chunk.response
9797
if res.output and len(res.output) > 0:

posthog/test/ai/openai/test_openai.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ def test_responses_api(mock_client):
541541

542542
call_args = mock_client.capture.call_args[1]
543543
props = call_args["properties"]
544-
print(props)
545544
assert props["$ai_provider"] == "openai"
546545
assert props["$ai_model"] == "gpt-4o-mini"
547546
assert props["$ai_input"] == [{"role": "user", "content": "Hello"}]

0 commit comments

Comments
 (0)