Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,31 @@ os.environ["SERPER_API_KEY"] = "3814ecb904f7401e22386b7b7ee3a6f913741c5"
|
|
| 11 |
hf_token = os.environ.get("Hugging_Face_API_Token")
|
| 12 |
model=InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta", api_key=hf_token)
|
| 13 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# --- Basic Agent Definition ---
|
| 16 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
@@ -24,6 +49,7 @@ class BasicAgent:
|
|
| 24 |
self.search_tool,
|
| 25 |
self.web_page_tool
|
| 26 |
],
|
|
|
|
| 27 |
additional_authorized_imports=["pandas"],
|
| 28 |
max_steps=5,
|
| 29 |
)
|
|
|
|
| 11 |
hf_token = os.environ.get("Hugging_Face_API_Token")
|
| 12 |
model=InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta", api_key=hf_token)
|
| 13 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 14 |
+
SYSTEM_PROMPT = """
|
| 15 |
+
You are a helpful, tool-using AI assistant.
|
| 16 |
+
You are required to solve real-world questions using search and reasoning.
|
| 17 |
+
|
| 18 |
+
ALWAYS use tools (GoogleSearchTool, VisitWebpageTool, etc.) to answer factual questions.
|
| 19 |
+
|
| 20 |
+
You must reason step-by-step like this:
|
| 21 |
+
|
| 22 |
+
Thought: I need to find ...
|
| 23 |
+
Action: tool_name(tool_input)
|
| 24 |
+
Observation: tool_output
|
| 25 |
+
(repeat as needed)
|
| 26 |
+
|
| 27 |
+
After you're confident in your answer, return the result using this exact code format:
|
| 28 |
+
|
| 29 |
+
```py
|
| 30 |
+
final_answer(
|
| 31 |
+
short="your short final answer here",
|
| 32 |
+
long="your detailed explanation with justification here"
|
| 33 |
+
)
|
| 34 |
+
```<end_code>
|
| 35 |
+
|
| 36 |
+
Do NOT forget the triple backticks and the `<end_code>` tag — they are required for evaluation.
|
| 37 |
+
Even if you can't answer the question fully, always provide reasoning and return a final_answer block.
|
| 38 |
+
"""
|
| 39 |
|
| 40 |
# --- Basic Agent Definition ---
|
| 41 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
|
| 49 |
self.search_tool,
|
| 50 |
self.web_page_tool
|
| 51 |
],
|
| 52 |
+
system_prompt=SYSTEM_PROMPT,
|
| 53 |
additional_authorized_imports=["pandas"],
|
| 54 |
max_steps=5,
|
| 55 |
)
|