Skip to content

Commit

Permalink
fixed tool examples in prompts (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandJAAI authored Jan 24, 2025
1 parent b5b55a5 commit 0196dc7
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/smolagents/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@
Action:
{
"tool_name": "image_transformer",
"tool_arguments": {"image": "image_1.jpg"}
"name": "image_transformer",
"arguments": {"image": "image_1.jpg"}
}
To provide the final answer to the task, use an action blob with "tool_name": "final_answer" tool. It is the only way to complete the task, else you will be stuck on a loop. So your final output should look like this:
To provide the final answer to the task, use an action blob with "name": "final_answer" tool. It is the only way to complete the task, else you will be stuck on a loop. So your final output should look like this:
Action:
{
"tool_name": "final_answer",
"tool_arguments": {"answer": "insert your final answer here"}
"name": "final_answer",
"arguments": {"answer": "insert your final answer here"}
}
Expand All @@ -143,62 +143,62 @@
Action:
{
"tool_name": "document_qa",
"tool_arguments": {"document": "document.pdf", "question": "Who is the oldest person mentioned?"}
"name": "document_qa",
"arguments": {"document": "document.pdf", "question": "Who is the oldest person mentioned?"}
}
Observation: "The oldest person in the document is John Doe, a 55 year old lumberjack living in Newfoundland."
Action:
{
"tool_name": "image_generator",
"tool_arguments": {"prompt": "A portrait of John Doe, a 55-year-old man living in Canada."}
"name": "image_generator",
"arguments": {"prompt": "A portrait of John Doe, a 55-year-old man living in Canada."}
}
Observation: "image.png"
Action:
{
"tool_name": "final_answer",
"tool_arguments": "image.png"
"name": "final_answer",
"arguments": "image.png"
}
---
Task: "What is the result of the following operation: 5 + 3 + 1294.678?"
Action:
{
"tool_name": "python_interpreter",
"tool_arguments": {"code": "5 + 3 + 1294.678"}
"name": "python_interpreter",
"arguments": {"code": "5 + 3 + 1294.678"}
}
Observation: 1302.678
Action:
{
"tool_name": "final_answer",
"tool_arguments": "1302.678"
"name": "final_answer",
"arguments": "1302.678"
}
---
Task: "Which city has the highest population , Guangzhou or Shanghai?"
Action:
{
"tool_name": "search",
"tool_arguments": "Population Guangzhou"
"name": "search",
"arguments": "Population Guangzhou"
}
Observation: ['Guangzhou has a population of 15 million inhabitants as of 2021.']
Action:
{
"tool_name": "search",
"tool_arguments": "Population Shanghai"
"name": "search",
"arguments": "Population Shanghai"
}
Observation: '26 million (2019)'
Action:
{
"tool_name": "final_answer",
"tool_arguments": "Shanghai"
"name": "final_answer",
"arguments": "Shanghai"
}
Expand Down

0 comments on commit 0196dc7

Please sign in to comment.