没耐心写了直接看输入输出,输出默认都是stop前:
输入:
System: Respond to the human as helpfully and accurately as possible. You have access to the following tools:
Calculator: Useful for when you need to calculate math problems, args: {'calculation': {'description': 'calculation to perform', 'title': 'Calculation', 'type': 'string'}}
DistanceConverter: Converts distance between meters, kilometers, and feet, args: {'distance': {'description': 'The numeric value of the distance to be converted, returning a number (integer or floating-point', 'title': 'Distance', 'type': 'number'}, 'unit': {'description': 'The current unit of the distance into(m, km, or feet)', 'title': 'Unit', 'type': 'string'}, 'to_unit': {'description': 'The target unit to convert the distance into (m, km, or feet)', 'title': 'To Unit', 'type': 'string'}}Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
Valid "action" values: "Final Answer" or Calculator, DistanceConverter
Provide only ONE action per $JSON_BLOB, as shown:
```
{
"action": $TOOL_NAME,
"action_input": $INPUT
}
```Follow this format:
Question: input question to answer
Thought: consider previous and subsequent steps
Action:
```
$JSON_BLOB
```
Observation: action result
... (repeat Thought/Action/Observation N times)
Thought: I know what to respond
Action:
```
{
"action": "Final Answer",
"action_input": "Final response to human"
}Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation
Human: 光明操场的跑道一圈534米,小明跑了234圈,请问小明一共跑了多少米?转换为千米呢?```
{
"action": "Calculator",
"action_input": "534*234"
}
```
Observation: 124956
Thought:
(reminder to respond in a JSON blob no matter what)
输出:
```
{
"action": "DistanceConverter",
"action_input": {
"distance": 124956,
"unit": "meters",
"to_unit": "kilometers"
}
}
```
输入:
System: 略
Human: 光明操场的跑道一圈534米,小明跑了234圈,请问小明一共跑了多少米?转换为千米呢?
```
{
"action": "Calculator",
"action_input": "534*234"
}
```
Observation: 124956
Thought: ```
{
"action": "DistanceConverter",
"action_input": {
"distance": 124956,
"unit": "meters",
"to_unit": "kilometers"
}
}
```
Observation: 124956.0 meters is equal to 124956.0 kilometers
Thought:
(reminder to respond in a JSON blob no matter what)
输出:
```
{
"action": "Final Answer",
"action_input": "小明一共跑了124956米,也就是124956.0千米。"
}
```
最后打印了> Finished chain.
可见简单的多工具情况下,并不是第一轮就分析出整条调用顺序,而是每轮都重新猜测本轮要调用哪个工具。这个合理的。
然后这个DistanceConverter工具解析得不太对,看system其实是有写明单位名称约束的,但我的模型没有做到这一点:
'unit': {'description': 'The current unit of the distance into(m, km, or feet)', 'title': 'Unit', 'type': 'string'}, 'to_unit': {'description': 'The target unit to convert the distance into (m, km, or feet)'