mirror of
https://github.com/run-llama/product-specs-comparison.git
synced 2026-07-01 21:24:01 -04:00
fix: use posthog async
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user