Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
common/aagents/healthcare_agent.py
CHANGED
|
@@ -3,6 +3,8 @@ import os
|
|
| 3 |
from agents import Agent, OpenAIChatCompletionsModel
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from openai import AsyncOpenAI
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Import tools
|
| 8 |
from common.mcp.tools.rag_tool import rag_search, UserContext
|
|
@@ -21,6 +23,7 @@ load_dotenv()
|
|
| 21 |
GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 22 |
google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 23 |
gemini_client = AsyncOpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)
|
|
|
|
| 24 |
gemini_model = OpenAIChatCompletionsModel(model="gemini-2.0-flash-exp", openai_client=gemini_client)
|
| 25 |
|
| 26 |
GROQ_BASE_URL = "https://api.groq.com/openai/v1"
|
|
|
|
| 3 |
from agents import Agent, OpenAIChatCompletionsModel
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from openai import AsyncOpenAI
|
| 6 |
+
from langsmith import wrappers
|
| 7 |
+
|
| 8 |
|
| 9 |
# Import tools
|
| 10 |
from common.mcp.tools.rag_tool import rag_search, UserContext
|
|
|
|
| 23 |
GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 24 |
google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 25 |
gemini_client = AsyncOpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)
|
| 26 |
+
gemini_client = wrappers.wrap_openai(gemini_client)
|
| 27 |
gemini_model = OpenAIChatCompletionsModel(model="gemini-2.0-flash-exp", openai_client=gemini_client)
|
| 28 |
|
| 29 |
GROQ_BASE_URL = "https://api.groq.com/openai/v1"
|
pyproject.toml
CHANGED
|
@@ -121,7 +121,11 @@ dependencies = [
|
|
| 121 |
# =======================
|
| 122 |
# OBSERVABILITY
|
| 123 |
# =======================
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
]
|
| 126 |
|
| 127 |
[dependency-groups]
|
|
|
|
| 121 |
# =======================
|
| 122 |
# OBSERVABILITY
|
| 123 |
# =======================
|
| 124 |
+
"openinference-instrumentation-autogen>=0.1.0",
|
| 125 |
+
"openinference-instrumentation-openai>=0.1.0",
|
| 126 |
+
"opentelemetry-sdk>=1.20.0",
|
| 127 |
+
"opentelemetry-exporter-otlp>=1.20.0",
|
| 128 |
+
"opentelemetry-api>=1.20.0",
|
| 129 |
]
|
| 130 |
|
| 131 |
[dependency-groups]
|
src/deep-research/app.py
CHANGED
|
@@ -3,8 +3,13 @@ import asyncio
|
|
| 3 |
import time
|
| 4 |
import html
|
| 5 |
from io import BytesIO
|
| 6 |
-
import os
|
| 7 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from pathlib import Path
|
| 9 |
|
| 10 |
# Add project root
|
|
|
|
| 3 |
import time
|
| 4 |
import html
|
| 5 |
from io import BytesIO
|
|
|
|
| 6 |
import sys
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
# LangSmith Configuration (Overwrites)
|
| 10 |
+
os.environ["LANGCHAIN_TRACING_V2"] = "true"
|
| 11 |
+
os.environ["LANGCHAIN_PROJECT"] = "deep-research"
|
| 12 |
+
|
| 13 |
from pathlib import Path
|
| 14 |
|
| 15 |
# Add project root
|
src/deep-research/appagents/orchestrator.py
CHANGED
|
@@ -6,6 +6,8 @@ from appagents.email_agent import email_agent
|
|
| 6 |
from agents.exceptions import InputGuardrailTripwireTriggered
|
| 7 |
from core.logger import log_call
|
| 8 |
import asyncio
|
|
|
|
|
|
|
| 9 |
|
| 10 |
class Orchestrator:
|
| 11 |
|
|
@@ -13,6 +15,7 @@ class Orchestrator:
|
|
| 13 |
self.session = session or SQLiteSession()
|
| 14 |
|
| 15 |
@log_call
|
|
|
|
| 16 |
async def run(self, query: str):
|
| 17 |
""" Run the deep research process, yielding the status updates and the final report"""
|
| 18 |
trace_id = gen_trace_id()
|
|
|
|
| 6 |
from agents.exceptions import InputGuardrailTripwireTriggered
|
| 7 |
from core.logger import log_call
|
| 8 |
import asyncio
|
| 9 |
+
from langsmith import traceable
|
| 10 |
+
|
| 11 |
|
| 12 |
class Orchestrator:
|
| 13 |
|
|
|
|
| 15 |
self.session = session or SQLiteSession()
|
| 16 |
|
| 17 |
@log_call
|
| 18 |
+
@traceable(name="Deep Research Run")
|
| 19 |
async def run(self, query: str):
|
| 20 |
""" Run the deep research process, yielding the status updates and the final report"""
|
| 21 |
trace_id = gen_trace_id()
|
src/deep-research/appagents/search_agent.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
from agents import Agent, OpenAIChatCompletionsModel, WebSearchTool
|
| 3 |
from openai import AsyncOpenAI
|
|
|
|
|
|
|
| 4 |
|
| 5 |
from agents.model_settings import ModelSettings
|
| 6 |
from tools.google_tools import GoogleTools
|
|
@@ -27,6 +29,7 @@ essence and ignore any fluff. Do not include any additional commentary other tha
|
|
| 27 |
GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 28 |
google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 29 |
gemini_client = AsyncOpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)
|
|
|
|
| 30 |
gemini_model = OpenAIChatCompletionsModel(model="gemini-2.0-flash", openai_client=gemini_client)
|
| 31 |
|
| 32 |
# search_agent = Agent(
|
|
|
|
| 1 |
import os
|
| 2 |
from agents import Agent, OpenAIChatCompletionsModel, WebSearchTool
|
| 3 |
from openai import AsyncOpenAI
|
| 4 |
+
from langsmith import wrappers
|
| 5 |
+
|
| 6 |
|
| 7 |
from agents.model_settings import ModelSettings
|
| 8 |
from tools.google_tools import GoogleTools
|
|
|
|
| 29 |
GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
| 30 |
google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 31 |
gemini_client = AsyncOpenAI(base_url=GEMINI_BASE_URL, api_key=google_api_key)
|
| 32 |
+
gemini_client = wrappers.wrap_openai(gemini_client)
|
| 33 |
gemini_model = OpenAIChatCompletionsModel(model="gemini-2.0-flash", openai_client=gemini_client)
|
| 34 |
|
| 35 |
# search_agent = Agent(
|