You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift infer --model_type chatglm3-6b-32k --eval_human true --stop_words Observation: --infer_backend pt
276
+
```
277
+
278
+
运行命令后,改变system字段:
279
+
280
+
```shell
281
+
# 单行system
282
+
<<<reset-system
283
+
<<< Answer the following questions as best you can. You have access to the following APIs:\n1. fire_recognition: Call this tool to interact with the fire recognition API. This API is used to recognize whether there is fire in the image. Parameters: [{"name": "image", "description": "The input image to recognize fire", "required": "True"}]\n\n2. fire_alert: Call this tool to interact with the fire alert API. This API will start an alert to warn the building's administraters. Parameters: []\n\n3. call_police: Call this tool to interact with the police calling API. This API will call 110 to catch the thief. Parameters: []\n\n4. call_fireman: Call this tool to interact with the fireman calling API. This API will call 119 to extinguish the fire. Parameters: []\n\nUse the following format:\n\nThought: you should always think about what to do\nAction: the action to take, should be one of the above tools[fire_recognition, fire_alert, call_police, call_fireman]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question\nBegin!
284
+
```
285
+
286
+
如果需要以多行方式输入,可以用下面的命令(多行信息以#号结束):
287
+
288
+
```shell
289
+
# 多行system
290
+
<<<multi-line#
291
+
<<<[M] reset-system#
292
+
<<<[MS] Answer the following questions as best you can. You have access to the following APIs:
293
+
1. fire_recognition: Call this tool to interact with the fire recognition API. This API is used to recognize whether there is fire in the image. Parameters: [{"name": "image", "description": "The input image to recognize fire", "required": "True"}]
294
+
295
+
2. fire_alert: Call this tool to interact with the fire alert API. This API will start an alert to warn the building's administraters. Parameters: []
296
+
297
+
3. call_police: Call this tool to interact with the police calling API. This API will call 110 to catch the thief. Parameters: []
298
+
299
+
4. call_fireman: Call this tool to interact with the fireman calling API. This API will call 119 to extinguish the fire. Parameters: []
300
+
301
+
Use the following format:
302
+
303
+
Thought: you should always think about what to do
304
+
Action: the action to take, should be one of the above tools[fire_recognition, fire_alert, call_police, call_fireman]
305
+
Action Input: the input to the action
306
+
Observation: the result of the action
307
+
... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
308
+
Thought: I now know the final answer
309
+
Final Answer: the final answer to the original input question
310
+
Begin!#
311
+
```
312
+
313
+
下面就可以进行Agent问答:
314
+
315
+
```shell
316
+
<<< 输入图片是/tmp/1.jpg,协助判断图片中是否存在着火点
317
+
Thought: I need to use the fire\_recognition API to analyze the input image and determine if there are any signs of fire.
318
+
319
+
Action: Use the fire\_recognition API to analyze the input image.
swift deploy --model_type chatglm3-6b-32k --stop_words Observation:
340
+
```
341
+
342
+
客户端:
343
+
344
+
```python
345
+
from openai import OpenAI
346
+
client = OpenAI(
347
+
api_key='EMPTY',
348
+
base_url='http://localhost:8000/v1',
349
+
)
350
+
model_type = client.models.list().data[0].id
351
+
print(f'model_type: {model_type}')
352
+
353
+
system = """Answer the following questions as best you can. You have access to the following APIs:
354
+
1. fire_recognition: Call this tool to interact with the fire recognition API. This API is used to recognize whether there is fire in the image. Parameters: [{\"name\": \"image\", \"description\": \"The input image to recognize fire\", \"required\": \"True\"}]
355
+
356
+
2. fire_alert: Call this tool to interact with the fire alert API. This API will start an alert to warn the building's administraters. Parameters: []
357
+
358
+
3. call_police: Call this tool to interact with the police calling API. This API will call 110 to catch the thief. Parameters: []
359
+
360
+
4. call_fireman: Call this tool to interact with the fireman calling API. This API will call 119 to extinguish the fire. Parameters: []
361
+
362
+
Use the following format:
363
+
364
+
Thought: you should always think about what to do
365
+
Action: the action to take, should be one of the above tools[fire_recognition, fire_alert, call_police, call_fireman]
366
+
Action Input: the input to the action
367
+
Observation: the result of the action
368
+
... (this Thought/Action/Action Input/Observation can be repeated zero or more times)
369
+
Thought: I now know the final answer
370
+
Final Answer: the final answer to the original input question
# response: Thought: I need to check if there is fire in the image
404
+
# Action: Use fire\_recognition API
405
+
# Action Input: /tmp/2.jpg
406
+
# Observation:
407
+
# [{'role': 'system', 'content': 'Answer the following questions as best you can. You have access to the following APIs:\n1. fire_recognition: Call this tool to interact with the fire recognition API. This API is used to recognize whether there is fire in the image. Parameters: [{"name": "image", "description": "The input image to recognize fire", "required": "True"}]\n\n2. fire_alert: Call this tool to interact with the fire alert API. This API will start an alert to warn the building\'s administraters. Parameters: []\n\n3. call_police: Call this tool to interact with the police calling API. This API will call 110 to catch the thief. Parameters: []\n\n4. call_fireman: Call this tool to interact with the fireman calling API. This API will call 119 to extinguish the fire. Parameters: []\n\nUse the following format:\n\nThought: you should always think about what to do\nAction: the action to take, should be one of the above tools[fire_recognition, fire_alert, call_police, call_fireman]\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question\nBegin!'}, {'role': 'user', 'content': '输入图片是/tmp/2.jpg,协助判断图片中是否存在着火点'}, {'role': 'assistant', 'content': "Thought: I need to check if there is fire in the image\nAction: Use fire\\_recognition API\nAction Input: /tmp/2.jpg\nObservation:\n[{'coordinate': [101.1, 200.9], 'on_fire': True}]"}]
408
+
# response:
409
+
# Final Answer: There is fire in the image at coordinates [101.1, 200.9]
0 commit comments