Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -178,7 +178,29 @@ def get_type(state: InfoState) -> InfoState:
|
|
| 178 |
"""Choose which tool to use based on question type (WIKI, SEARCH, CODE)."""
|
| 179 |
print("Getting Type (Gemini)...")
|
| 180 |
|
| 181 |
-
prompt = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
model = ChatGoogleGenerativeAI(model="gemini-2.5-flash")
|
| 183 |
state["answer_type"] = (model.invoke([HumanMessage(content=prompt)]).content)
|
| 184 |
|
|
|
|
| 178 |
"""Choose which tool to use based on question type (WIKI, SEARCH, CODE)."""
|
| 179 |
print("Getting Type (Gemini)...")
|
| 180 |
|
| 181 |
+
prompt = f"""
|
| 182 |
+
You are a strict classifier.
|
| 183 |
+
According to the question below, choose **only one** of the following tools:
|
| 184 |
+
- WIKI → if the question is informative, factual, or science-related.
|
| 185 |
+
- WebInfo → if it requires up-to-date or current information (like news or dates).
|
| 186 |
+
- MATH → if it involves math, time, or numeric calculation.
|
| 187 |
+
- LLM → if it includes a link or anything else.
|
| 188 |
+
|
| 189 |
+
Question: "{state['question']}"
|
| 190 |
+
|
| 191 |
+
Rules:
|
| 192 |
+
- Output only one word: WIKI, WebInfo, MATH, or LLM.
|
| 193 |
+
- Do NOT write any explanation, punctuation, or extra text.
|
| 194 |
+
|
| 195 |
+
Examples:
|
| 196 |
+
Input: "What is the capital of France?"
|
| 197 |
+
Output: WIKI
|
| 198 |
+
|
| 199 |
+
Input: "What's the weather today in Cairo?"
|
| 200 |
+
Output: WebInfo
|
| 201 |
+
|
| 202 |
+
Now respond with one word only.
|
| 203 |
+
"""
|
| 204 |
model = ChatGoogleGenerativeAI(model="gemini-2.5-flash")
|
| 205 |
state["answer_type"] = (model.invoke([HumanMessage(content=prompt)]).content)
|
| 206 |
|