Skip to content

Commit 9a454f6

Browse files
committed
feat: clean up code, remove duplication and add examples for streaming with async or not
1 parent 04be8fb commit 9a454f6

File tree

6 files changed

+419
-367
lines changed

6 files changed

+419
-367
lines changed

llm_observability_examples.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main_sync():
3333

3434
async def main_async():
3535
try:
36-
#await basic_async_openai_call()
36+
await basic_async_openai_call()
3737
await streaming_async_openai_call()
3838
except Exception as e:
3939
print("Error during OpenAI call:", str(e))
@@ -93,6 +93,9 @@ async def streaming_async_openai_call():
9393

9494
return response
9595

96+
# HOW TO RUN:
97+
# comment out one of these to run the other
98+
9699
if __name__ == "__main__":
97100
main_sync()
98101

posthog/ai/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
from .openai import OpenAI, AsyncOpenAI
1+
from .providers.openai.openai import OpenAI
2+
from .providers.openai.openai_async import AsyncOpenAI
23

34
__all__ = ["OpenAI", "AsyncOpenAI"]

posthog/ai/openai.py

Lines changed: 0 additions & 365 deletions
This file was deleted.

0 commit comments

Comments
 (0)