Spaces:
Configuration error
Configuration error
oremaz
commited on
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -249,7 +249,7 @@ class IntelligentSourceRouter:
|
|
| 249 |
self.arxiv_tool = ArxivToolSpec().to_tool_list()[0]
|
| 250 |
self.duckduckgo_tool = DuckDuckGoSearchToolSpec().to_tool_list()[1]
|
| 251 |
|
| 252 |
-
def detect_intent_and_extract_content(self, query: str, max_results =
|
| 253 |
# Use your LLM to decide between arxiv and web_search
|
| 254 |
intent_prompt = f"""
|
| 255 |
Analyze this query and determine if it's scientific research or general information:
|
|
@@ -278,11 +278,11 @@ class IntelligentSourceRouter:
|
|
| 278 |
)
|
| 279 |
result = "\n".join(formatted)
|
| 280 |
results.append(f"**Web Search Results:**\n{result}")
|
|
|
|
| 281 |
except Exception as e:
|
| 282 |
results.append(f"**Search failed**: {str(e)}")
|
| 283 |
return "\n\n".join(results)
|
| 284 |
|
| 285 |
-
|
| 286 |
# Initialize router
|
| 287 |
intelligent_router = IntelligentSourceRouter()
|
| 288 |
|
|
|
|
| 249 |
self.arxiv_tool = ArxivToolSpec().to_tool_list()[0]
|
| 250 |
self.duckduckgo_tool = DuckDuckGoSearchToolSpec().to_tool_list()[1]
|
| 251 |
|
| 252 |
+
def detect_intent_and_extract_content(self, query: str, max_results = 1) -> str:
|
| 253 |
# Use your LLM to decide between arxiv and web_search
|
| 254 |
intent_prompt = f"""
|
| 255 |
Analyze this query and determine if it's scientific research or general information:
|
|
|
|
| 278 |
)
|
| 279 |
result = "\n".join(formatted)
|
| 280 |
results.append(f"**Web Search Results:**\n{result}")
|
| 281 |
+
print (results)
|
| 282 |
except Exception as e:
|
| 283 |
results.append(f"**Search failed**: {str(e)}")
|
| 284 |
return "\n\n".join(results)
|
| 285 |
|
|
|
|
| 286 |
# Initialize router
|
| 287 |
intelligent_router = IntelligentSourceRouter()
|
| 288 |
|