Skip to content

Commit 3599bbf

Browse files
committed
fix: formatting fun
1 parent 61b6b8c commit 3599bbf

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

llm_observability_examples.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,36 @@ def image_openai_call():
143143
print(response)
144144
return response
145145

146+
146147
# none instrumented
147148
async def image_async_openai_call():
148-
response = await async_openai_client.images.generate(model="dall-e-3", prompt="A cute baby hedgehog", n=1, size="1024x1024")
149+
response = await async_openai_client.images.generate(
150+
model="dall-e-3", prompt="A cute baby hedgehog", n=1, size="1024x1024"
151+
)
149152
print(response)
150153
return response
151154

152155

153156
def embedding_openai_call(posthog_distinct_id, posthog_trace_id, posthog_properties):
154-
response = openai_client.embeddings.create(input="The hedgehog is cute", model="text-embedding-3-small", posthog_distinct_id=posthog_distinct_id, posthog_trace_id=posthog_trace_id, posthog_properties=posthog_properties)
157+
response = openai_client.embeddings.create(
158+
input="The hedgehog is cute",
159+
model="text-embedding-3-small",
160+
posthog_distinct_id=posthog_distinct_id,
161+
posthog_trace_id=posthog_trace_id,
162+
posthog_properties=posthog_properties,
163+
)
155164
print(response)
156165
return response
157166

167+
158168
async def embedding_async_openai_call(posthog_distinct_id, posthog_trace_id, posthog_properties):
159-
response = await async_openai_client.embeddings.create(input="The hedgehog is cute", model="text-embedding-3-small", posthog_distinct_id=posthog_distinct_id, posthog_trace_id=posthog_trace_id, posthog_properties=posthog_properties)
169+
response = await async_openai_client.embeddings.create(
170+
input="The hedgehog is cute",
171+
model="text-embedding-3-small",
172+
posthog_distinct_id=posthog_distinct_id,
173+
posthog_trace_id=posthog_trace_id,
174+
posthog_properties=posthog_properties,
175+
)
160176
print(response)
161177
return response
162178

posthog/ai/openai/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ def create(
234234
properties=event_properties,
235235
)
236236

237-
return response
237+
return response

posthog/ai/openai/openai_async.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, posthog_client: PostHogClient, **kwargs):
3131
self.chat = WrappedChat(self)
3232
self.embeddings = WrappedEmbeddings(self)
3333

34+
3435
class WrappedChat(openai.resources.chat.AsyncChat):
3536
_client: AsyncOpenAI
3637

@@ -168,6 +169,7 @@ def _capture_streaming_event(
168169
properties=event_properties,
169170
)
170171

172+
171173
class WrappedEmbeddings(openai.resources.embeddings.AsyncEmbeddings):
172174
_client: AsyncOpenAI
173175

0 commit comments

Comments
 (0)