fix: use posthog async

This commit is contained in:
Clelia (Astra) Bertelli
2026-02-11 14:32:21 +01:00
parent 5de72e0041
commit 5912710089
+3 -1
View File
@@ -5,7 +5,7 @@ from llama_cloud import AsyncLlamaCloud
from llama_index.core.llms.structured_llm import StructuredLLM
from llama_index.llms.openai import OpenAI as LlamaOpenAI
from posthog import Posthog
from posthog.ai.openai import OpenAI
from posthog.ai.openai import AsyncOpenAI, OpenAI
from pydantic import BaseModel
from workflows.resource import ResourceConfig
@@ -92,12 +92,14 @@ def get_llm(
)
openai_client = OpenAI(api_key=config.openai_api_key, posthog_client=posthog)
openai_aclient = AsyncOpenAI(api_key=config.openai_api_key, posthog_client=posthog)
llm = LlamaOpenAI(
model=cast(str, config.model),
api_key=config.openai_api_key,
)
llm._client = openai_client
llm._aclient = openai_aclient
return llm.as_structured_llm(ProductComparison)