Spaces:
Sleeping
Sleeping
Essai avec instructions=
Browse files
agent.py
CHANGED
|
@@ -10,7 +10,7 @@ from smolagents import (
|
|
| 10 |
# HfApiModel, # import bug from smolagents after adding duckduckgo-search in requirements
|
| 11 |
tool
|
| 12 |
)
|
| 13 |
-
from smolagents.prompts import CODE_SYSTEM_PROMPT
|
| 14 |
from typing import List, Dict, Any, Optional
|
| 15 |
|
| 16 |
|
|
@@ -32,7 +32,7 @@ class QAgent:
|
|
| 32 |
"""
|
| 33 |
# Enhance system prompt for GAIA test
|
| 34 |
extra="You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."
|
| 35 |
-
custom_prompt = f"{extra}\n\n{CODE_SYSTEM_PROMPT}"
|
| 36 |
|
| 37 |
|
| 38 |
print(f"Begin QAgent init with: ")
|
|
@@ -115,16 +115,17 @@ class QAgent:
|
|
| 115 |
|
| 116 |
# Setup imports
|
| 117 |
self.imports = ["pandas", "numpy", "datetime", "json", "re", "math", "os", "requests", "csv", "urllib"]
|
| 118 |
-
custom_templates = PromptTemplates(
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
)
|
| 122 |
# Create CodeAgent
|
| 123 |
print(f"Begin creating CodeAgent")
|
| 124 |
self.agent = CodeAgent(
|
| 125 |
tools=self.tools,
|
| 126 |
model=self.model,
|
| 127 |
-
|
|
|
|
| 128 |
# additional_authorized_imports=self.imports,
|
| 129 |
# executor_type=executor_type,
|
| 130 |
# executor_kwargs=executor_kwargs,
|
|
|
|
| 10 |
# HfApiModel, # import bug from smolagents after adding duckduckgo-search in requirements
|
| 11 |
tool
|
| 12 |
)
|
| 13 |
+
# from smolagents.prompts import CODE_SYSTEM_PROMPT
|
| 14 |
from typing import List, Dict, Any, Optional
|
| 15 |
|
| 16 |
|
|
|
|
| 32 |
"""
|
| 33 |
# Enhance system prompt for GAIA test
|
| 34 |
extra="You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."
|
| 35 |
+
# custom_prompt = f"{extra}\n\n{CODE_SYSTEM_PROMPT}"
|
| 36 |
|
| 37 |
|
| 38 |
print(f"Begin QAgent init with: ")
|
|
|
|
| 115 |
|
| 116 |
# Setup imports
|
| 117 |
self.imports = ["pandas", "numpy", "datetime", "json", "re", "math", "os", "requests", "csv", "urllib"]
|
| 118 |
+
# custom_templates = PromptTemplates(
|
| 119 |
+
# system_prompt=custom_prompt,
|
| 120 |
+
# planning=PlanningPromptTemplate(template="Remember: reflect deeply."),
|
| 121 |
+
# )
|
| 122 |
# Create CodeAgent
|
| 123 |
print(f"Begin creating CodeAgent")
|
| 124 |
self.agent = CodeAgent(
|
| 125 |
tools=self.tools,
|
| 126 |
model=self.model,
|
| 127 |
+
instructions=extra,
|
| 128 |
+
# prompt_templates=custom_templates,
|
| 129 |
# additional_authorized_imports=self.imports,
|
| 130 |
# executor_type=executor_type,
|
| 131 |
# executor_kwargs=executor_kwargs,
|