test with a simple file
This commit is contained in:
parent
d1fa826aeb
commit
352ea257e8
3 changed files with 19 additions and 0 deletions
|
|
@ -7,9 +7,23 @@ from tenacity import retry, stop_after_attempt
|
||||||
from openai import AsyncOpenAI
|
from openai import AsyncOpenAI
|
||||||
import openai
|
import openai
|
||||||
|
|
||||||
|
from cognee.config import Config
|
||||||
from cognee.infrastructure import infrastructure_config
|
from cognee.infrastructure import infrastructure_config
|
||||||
from cognee.infrastructure.llm.llm_interface import LLMInterface
|
from cognee.infrastructure.llm.llm_interface import LLMInterface
|
||||||
from cognee.infrastructure.llm.prompts import read_query_prompt
|
from cognee.infrastructure.llm.prompts import read_query_prompt
|
||||||
|
from cognee.shared.data_models import MonitoringTool
|
||||||
|
|
||||||
|
config = Config()
|
||||||
|
config.load()
|
||||||
|
|
||||||
|
if config.monitoring_tool == MonitoringTool.LANGFUSE:
|
||||||
|
from langfuse.openai import AsyncOpenAI, OpenAI
|
||||||
|
elif config.monitoring_tool == MonitoringTool.LANGSMITH:
|
||||||
|
from langsmith import wrap_openai
|
||||||
|
from openai import AsyncOpenAI
|
||||||
|
AsyncOpenAI = wrap_openai(AsyncOpenAI())
|
||||||
|
else:
|
||||||
|
from openai import AsyncOpenAI, OpenAI
|
||||||
|
|
||||||
class GenericAPIAdapter(LLMInterface):
|
class GenericAPIAdapter(LLMInterface):
|
||||||
"""Adapter for Generic API LLM provider API """
|
"""Adapter for Generic API LLM provider API """
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ config.load()
|
||||||
|
|
||||||
if config.monitoring_tool == MonitoringTool.LANGFUSE:
|
if config.monitoring_tool == MonitoringTool.LANGFUSE:
|
||||||
from langfuse.openai import AsyncOpenAI, OpenAI
|
from langfuse.openai import AsyncOpenAI, OpenAI
|
||||||
|
elif config.monitoring_tool == MonitoringTool.LANGSMITH:
|
||||||
|
from langsmith import wrap_openai
|
||||||
|
from openai import AsyncOpenAI
|
||||||
|
AsyncOpenAI = wrap_openai(AsyncOpenAI())
|
||||||
else:
|
else:
|
||||||
from openai import AsyncOpenAI, OpenAI
|
from openai import AsyncOpenAI, OpenAI
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,4 +257,5 @@ class MonitoringTool(str, Enum):
|
||||||
""" Monitoring tools """
|
""" Monitoring tools """
|
||||||
LANGFUSE = "langfuse"
|
LANGFUSE = "langfuse"
|
||||||
LLMLITE = "llmlite"
|
LLMLITE = "llmlite"
|
||||||
|
LANGSMITH = "langsmith"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue