Skip to content

Commit bc713a6

Browse files
committed
fix: did things and stuff
1 parent e5963dd commit bc713a6

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

posthog/ai/openai/openai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
import uuid
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict, List, Optional
44

55
try:
66
import openai
@@ -171,7 +171,7 @@ def _capture_streaming_event(
171171
usage_stats: Dict[str, int],
172172
latency: float,
173173
output: str,
174-
tool_calls=None,
174+
tool_calls: Optional[List[Dict[str, Any]]] = None,
175175
):
176176
if posthog_trace_id is None:
177177
posthog_trace_id = uuid.uuid4()

posthog/ai/openai/openai_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import time
22
import uuid
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict, List, Optional
44

55
try:
66
import openai
@@ -169,7 +169,7 @@ async def _capture_streaming_event(
169169
usage_stats: Dict[str, int],
170170
latency: float,
171171
output: str,
172-
tool_calls=None,
172+
tool_calls: Optional[List[Dict[str, Any]]] = None,
173173
):
174174
if posthog_trace_id is None:
175175
posthog_trace_id = uuid.uuid4()

posthog/test/ai/openai/test_openai.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
import pytest
66
from openai.types.chat import ChatCompletion, ChatCompletionMessage
77
from openai.types.chat.chat_completion import Choice
8-
from openai.types.chat.chat_completion_chunk import (
9-
ChatCompletionChunk,
10-
Choice as ChoiceChunk,
11-
ChoiceDelta,
12-
ChoiceDeltaToolCall,
13-
ChoiceDeltaToolCallFunction,
14-
)
8+
from openai.types.chat.chat_completion_chunk import ChatCompletionChunk
9+
from openai.types.chat.chat_completion_chunk import Choice as ChoiceChunk
10+
from openai.types.chat.chat_completion_chunk import ChoiceDelta, ChoiceDeltaToolCall, ChoiceDeltaToolCallFunction
1511
from openai.types.chat.chat_completion_message_tool_call import ChatCompletionMessageToolCall, Function
1612
from openai.types.completion_usage import CompletionUsage
1713
from openai.types.create_embedding_response import CreateEmbeddingResponse, Usage

0 commit comments

Comments
 (0)