Update research_agent.py
Browse files- research_agent.py +1 -24
research_agent.py
CHANGED
|
@@ -15,7 +15,7 @@ class ResearchAgent(BaseAgent):
|
|
| 15 |
def __init__(self, model: str):
|
| 16 |
super().__init__(model=model)
|
| 17 |
|
| 18 |
-
def __call__(self, question: str, **kwargs) -> str:
|
| 19 |
print(f"Research agent processing question: {question[:100]}...")
|
| 20 |
|
| 21 |
# First extract the search query using LLM
|
|
@@ -223,29 +223,6 @@ class ResearchAgent(BaseAgent):
|
|
| 223 |
result.append(row_data)
|
| 224 |
|
| 225 |
return result
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
def extract_search_query(self, question: str) -> str:
|
| 229 |
-
"""
|
| 230 |
-
Extract the key search terms from the question.
|
| 231 |
-
|
| 232 |
-
Args:
|
| 233 |
-
question: The original question
|
| 234 |
-
|
| 235 |
-
Returns:
|
| 236 |
-
A reformulated search query
|
| 237 |
-
"""
|
| 238 |
-
system_prompt = """
|
| 239 |
-
You are an expert at extracting search terms from questions.
|
| 240 |
-
Given a question, identify the key terms that would be most effective for a web search.
|
| 241 |
-
Remove any unnecessary words and focus on specific names, dates, or key concepts.
|
| 242 |
-
Return only the search terms, with no additional text.
|
| 243 |
-
"""
|
| 244 |
-
|
| 245 |
-
user_prompt = f"Extract the most effective search terms from this question: {question}"
|
| 246 |
-
|
| 247 |
-
response = self.llm_call(system_prompt, user_prompt)
|
| 248 |
-
return response.strip()
|
| 249 |
|
| 250 |
def search_web(self, query: str, max_results: int = 5) -> List[Dict[str, str]]:
|
| 251 |
"""
|
|
|
|
| 15 |
def __init__(self, model: str):
|
| 16 |
super().__init__(model=model)
|
| 17 |
|
| 18 |
+
def __call__(self, question: str, file_name: str = None, **kwargs) -> str:
|
| 19 |
print(f"Research agent processing question: {question[:100]}...")
|
| 20 |
|
| 21 |
# First extract the search query using LLM
|
|
|
|
| 223 |
result.append(row_data)
|
| 224 |
|
| 225 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
def search_web(self, query: str, max_results: int = 5) -> List[Dict[str, str]]:
|
| 228 |
"""
|