Spaces:
Sleeping
Sleeping
Update prompt templates to use simpler format
Browse files
app.py
CHANGED
|
@@ -22,9 +22,36 @@ model = HfApiModel(
|
|
| 22 |
token=hf_token,
|
| 23 |
)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# We're creating our CodeAgent with multiple tools
|
| 29 |
agent = CodeAgent(
|
| 30 |
model=model,
|
|
|
|
| 22 |
token=hf_token,
|
| 23 |
)
|
| 24 |
|
| 25 |
+
# Define prompt templates directly in the code
|
| 26 |
+
prompt_templates = {
|
| 27 |
+
"system": """You are a helpful AI assistant that can use tools to solve problems.
|
| 28 |
+
You have access to the following tools:
|
| 29 |
+
{{tools}}
|
| 30 |
+
|
| 31 |
+
When you want to use a tool, use this format:
|
| 32 |
+
```python
|
| 33 |
+
get_weather(location="New York")
|
| 34 |
+
```
|
| 35 |
+
or
|
| 36 |
+
```python
|
| 37 |
+
duck_duck_go_search(query="latest news about artificial intelligence")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
When you have a final answer, use:
|
| 41 |
+
```python
|
| 42 |
+
final_answer("Your detailed response here")
|
| 43 |
+
```""",
|
| 44 |
+
"user": "{{query}}",
|
| 45 |
+
"tool_response": """The result of your tool call was:
|
| 46 |
+
{{observation}}
|
| 47 |
+
|
| 48 |
+
What would you like to do next?""",
|
| 49 |
+
"final_answer": {
|
| 50 |
+
"pre_messages": "Please provide your final answer.",
|
| 51 |
+
"post_messages": "Let me know if you have any other questions!"
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
# We're creating our CodeAgent with multiple tools
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|