Skip to content

Commit 39005bb

Browse files
committed
fix: async + remove log
1 parent 04bd20c commit 39005bb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

posthog/ai/openai/openai.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ def parse(
280280
posthog_groups: Optional[Dict[str, Any]] = None,
281281
**kwargs: Any,
282282
):
283-
print("kwargs", kwargs)
284283
return call_llm_and_track_usage(
285284
posthog_distinct_id,
286285
self._client._ph_client,

posthog/ai/openai/openai_async.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self, posthog_client: PostHogClient, **kwargs):
3030
self._ph_client = posthog_client
3131
self.chat = WrappedChat(self)
3232
self.embeddings = WrappedEmbeddings(self)
33+
self.beta = WrappedBeta(self)
3334

3435

3536
class WrappedChat(openai.resources.chat.AsyncChat):
@@ -250,26 +251,26 @@ async def create(
250251
return response
251252

252253

253-
class WrappedBeta(openai.resources.beta.Beta):
254+
class WrappedBeta(openai.resources.beta.AsyncBeta):
254255
_client: AsyncOpenAI
255256

256257
@property
257258
def chat(self):
258259
return WrappedBetaChat(self._client)
259260

260261

261-
class WrappedBetaChat(openai.resources.beta.chat.Chat):
262+
class WrappedBetaChat(openai.resources.beta.chat.AsyncChat):
262263
_client: AsyncOpenAI
263264

264265
@property
265266
def completions(self):
266267
return WrappedBetaCompletions(self._client)
267268

268269

269-
class WrappedBetaCompletions(openai.resources.beta.chat.completions.Completions):
270+
class WrappedBetaCompletions(openai.resources.beta.chat.completions.AsyncCompletions):
270271
_client: AsyncOpenAI
271272

272-
def parse(
273+
async def parse(
273274
self,
274275
posthog_distinct_id: Optional[str] = None,
275276
posthog_trace_id: Optional[str] = None,
@@ -278,7 +279,7 @@ def parse(
278279
posthog_groups: Optional[Dict[str, Any]] = None,
279280
**kwargs: Any,
280281
):
281-
return call_llm_and_track_usage_async(
282+
return await call_llm_and_track_usage_async(
282283
posthog_distinct_id,
283284
self._client._ph_client,
284285
"openai",

0 commit comments

Comments
 (0)