Update app.py
Browse files
app.py
CHANGED
|
@@ -96,12 +96,7 @@ class AgentState(TypedDict):
|
|
| 96 |
answer: str
|
| 97 |
task_id: str | None = None
|
| 98 |
|
| 99 |
-
|
| 100 |
-
model_id=model_id,
|
| 101 |
-
api_base="https://api.groq.com/openai/v1",
|
| 102 |
-
api_key=GROQ_API_KEY,
|
| 103 |
-
timeout=60,
|
| 104 |
-
)
|
| 105 |
|
| 106 |
# class WebSearchAgent:
|
| 107 |
|
|
@@ -161,8 +156,13 @@ _exhausted_models: set[str] = set() # models that hit daily rate limits are ski
|
|
| 161 |
# --------------------------------------------------------------------------- #
|
| 162 |
# NODES (LangGraph functions) #
|
| 163 |
# --------------------------------------------------------------------------- #
|
| 164 |
-
_llm_router =
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
def route_question(state: AgentState) -> AgentState:
|
| 168 |
"""Label the task so we know which toolchain to invoke."""
|
|
@@ -293,7 +293,16 @@ def build_graph() -> StateGraph:
|
|
| 293 |
class LGAgent:
|
| 294 |
"""Callable wrapper used by run_and_submit_all."""
|
| 295 |
|
| 296 |
-
def __init__(self) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
self.graph = build_graph()
|
| 298 |
|
| 299 |
def __call__(self, question: str, task_id: str | None = None) -> str:
|
|
|
|
| 96 |
answer: str
|
| 97 |
task_id: str | None = None
|
| 98 |
|
| 99 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
# class WebSearchAgent:
|
| 102 |
|
|
|
|
| 156 |
# --------------------------------------------------------------------------- #
|
| 157 |
# NODES (LangGraph functions) #
|
| 158 |
# --------------------------------------------------------------------------- #
|
| 159 |
+
_llm_router = ChatOpenAI(
|
| 160 |
+
model=MODEL_CONFIGS[0]["model_id"],
|
| 161 |
+
base_url="https://api.groq.com/openai/v1",
|
| 162 |
+
api_key=GROQ_API_KEY,
|
| 163 |
+
timeout=60,
|
| 164 |
+
)
|
| 165 |
+
_llm_answer = _llm_router
|
| 166 |
|
| 167 |
def route_question(state: AgentState) -> AgentState:
|
| 168 |
"""Label the task so we know which toolchain to invoke."""
|
|
|
|
| 293 |
class LGAgent:
|
| 294 |
"""Callable wrapper used by run_and_submit_all."""
|
| 295 |
|
| 296 |
+
def __init__(self, model_id: str | None = None) -> None:
|
| 297 |
+
global _llm_router, _llm_answer
|
| 298 |
+
mid = model_id or MODEL_CONFIGS[0]["model_id"]
|
| 299 |
+
_llm_router = ChatOpenAI(
|
| 300 |
+
model=mid,
|
| 301 |
+
base_url="https://api.groq.com/openai/v1",
|
| 302 |
+
api_key=GROQ_API_KEY,
|
| 303 |
+
timeout=60,
|
| 304 |
+
)
|
| 305 |
+
_llm_answer = _llm_router
|
| 306 |
self.graph = build_graph()
|
| 307 |
|
| 308 |
def __call__(self, question: str, task_id: str | None = None) -> str:
|