Update app.py
Browse files
app.py
CHANGED
|
@@ -11,16 +11,23 @@ from smolagents import DuckDuckGoSearchTool, CodeAgent, LiteLLMModel
|
|
| 11 |
# --- Constants ---
|
| 12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# --- Basic Agent Definition ---
|
| 15 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 16 |
class BasicAgent:
|
| 17 |
def __init__(self):
|
| 18 |
print("Initializing BasicAgent.")
|
| 19 |
-
model_id = "gemini/gemini-2.0-flash-
|
| 20 |
|
| 21 |
self.model = LiteLLMModel(
|
| 22 |
model_id=model_id,
|
| 23 |
api_key=os.environ.get('GOOGLE_API_KEY')
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
search_tool = DuckDuckGoSearchTool()
|
|
|
|
| 11 |
# --- Constants ---
|
| 12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 13 |
|
| 14 |
+
SYSTEM_PROMPT = """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].
|
| 15 |
+
YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings.
|
| 16 |
+
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.
|
| 17 |
+
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.
|
| 18 |
+
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."""
|
| 19 |
+
|
| 20 |
# --- Basic Agent Definition ---
|
| 21 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 22 |
class BasicAgent:
|
| 23 |
def __init__(self):
|
| 24 |
print("Initializing BasicAgent.")
|
| 25 |
+
model_id = "gemini/gemini-2.0-flash-lite"
|
| 26 |
|
| 27 |
self.model = LiteLLMModel(
|
| 28 |
model_id=model_id,
|
| 29 |
api_key=os.environ.get('GOOGLE_API_KEY')
|
| 30 |
+
system_prompt=SYSTEM_PROMPT
|
| 31 |
)
|
| 32 |
|
| 33 |
search_tool = DuckDuckGoSearchTool()
|