Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -167,6 +167,7 @@ from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_excep
|
|
| 167 |
|
| 168 |
#class RetryDuckDuckGoSearchTool(DuckDuckGoSearchTool):
|
| 169 |
# @retry(
|
|
|
|
| 170 |
# stop=stop_after_attempt(3),
|
| 171 |
# wait=wait_exponential(multiplier=1, min=4, max=10),
|
| 172 |
# retry=retry_if_exception_type(Exception)
|
|
@@ -183,7 +184,7 @@ class MagAgent:
|
|
| 183 |
|
| 184 |
print("Initializing MagAgent with search tools...")
|
| 185 |
model = LiteLLMModel(
|
| 186 |
-
model_id="gemini/gemini-
|
| 187 |
api_key=os.environ.get("GEMINI_KEY"),
|
| 188 |
max_tokens=8192
|
| 189 |
)
|
|
@@ -223,12 +224,14 @@ class MagAgent:
|
|
| 223 |
- Reason step-by-step. Think through the solution logically and plan your actions carefully before answering.
|
| 224 |
- Validate information. Always verify facts when possible instead of guessing.
|
| 225 |
- When processing external data (e.g., YouTube transcripts, web searches), expect potential issues like missing punctuation, inconsistent formatting, or conversational text.
|
|
|
|
| 226 |
- If the input is ambiguous, prioritize extracting key information relevant to the question.
|
| 227 |
- Use code if needed. For calculations, parsing, or transformations, generate Python code and execute it. Be cautious, as some questions contain time-consuming tasks, so analyze the question and choose the most efficient solution.
|
| 228 |
- Be precise and concise. The final answer must strictly match the required format with no extra commentary.
|
| 229 |
- Use tools intelligently. If a question involves external information, structured data, images, or audio, call the appropriate tool to retrieve or process it.
|
| 230 |
- If the question includes direct speech or quoted text (e.g., "Isn't that hot?"), treat it as a precise query and preserve the quoted structure in your response, including quotation marks for direct quotes (e.g., final_answer('"Extremely."')).
|
| 231 |
- If asked about the name of a place or city, use the full complete name without abbreviations (e.g., use Saint Petersburg instead of St.Petersburg).
|
|
|
|
| 232 |
- If you cannot retrieve or process data (e.g., due to blocked requests), retry after 15 seconds delay, try another tool (try wikipedia_search, then web_search, then search_arxiv). Otherwise, return a clear error message: "Unable to retrieve data. Search has failed."
|
| 233 |
- Use `final_answer` to give the final answer.
|
| 234 |
|
|
|
|
| 167 |
|
| 168 |
#class RetryDuckDuckGoSearchTool(DuckDuckGoSearchTool):
|
| 169 |
# @retry(
|
| 170 |
+
|
| 171 |
# stop=stop_after_attempt(3),
|
| 172 |
# wait=wait_exponential(multiplier=1, min=4, max=10),
|
| 173 |
# retry=retry_if_exception_type(Exception)
|
|
|
|
| 184 |
|
| 185 |
print("Initializing MagAgent with search tools...")
|
| 186 |
model = LiteLLMModel(
|
| 187 |
+
model_id="gemini/gemini-1.5-flash",
|
| 188 |
api_key=os.environ.get("GEMINI_KEY"),
|
| 189 |
max_tokens=8192
|
| 190 |
)
|
|
|
|
| 224 |
- Reason step-by-step. Think through the solution logically and plan your actions carefully before answering.
|
| 225 |
- Validate information. Always verify facts when possible instead of guessing.
|
| 226 |
- When processing external data (e.g., YouTube transcripts, web searches), expect potential issues like missing punctuation, inconsistent formatting, or conversational text.
|
| 227 |
+
- When asked to transcript YouTube video, try searching it in www.youtubetotranscript.com.
|
| 228 |
- If the input is ambiguous, prioritize extracting key information relevant to the question.
|
| 229 |
- Use code if needed. For calculations, parsing, or transformations, generate Python code and execute it. Be cautious, as some questions contain time-consuming tasks, so analyze the question and choose the most efficient solution.
|
| 230 |
- Be precise and concise. The final answer must strictly match the required format with no extra commentary.
|
| 231 |
- Use tools intelligently. If a question involves external information, structured data, images, or audio, call the appropriate tool to retrieve or process it.
|
| 232 |
- If the question includes direct speech or quoted text (e.g., "Isn't that hot?"), treat it as a precise query and preserve the quoted structure in your response, including quotation marks for direct quotes (e.g., final_answer('"Extremely."')).
|
| 233 |
- If asked about the name of a place or city, use the full complete name without abbreviations (e.g., use Saint Petersburg instead of St.Petersburg).
|
| 234 |
+
- If asked to look up page numbers, make sure you don't mix them with problem or excercise numbers.
|
| 235 |
- If you cannot retrieve or process data (e.g., due to blocked requests), retry after 15 seconds delay, try another tool (try wikipedia_search, then web_search, then search_arxiv). Otherwise, return a clear error message: "Unable to retrieve data. Search has failed."
|
| 236 |
- Use `final_answer` to give the final answer.
|
| 237 |
|