You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
2.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2025/3/16 09:46
# @Author : old-tom
# @File : llm_agent
# @Project : llmFunctionCallDemo
# @Desc : llm代理负责初始化模型
# Press the green button in the gutter to run the script.
from llm_agent import DeepSeekR1Agent
if __name__ == '__main__':
dsr = DeepSeekR1Agent()
# print(dsr.invoke_with_tool('今天北京天气怎么样'))
########## 测试 模型function call #########
# print(dsr.invoke_with_tool('播放北卡口1号道相机'))
## [{'name': 'play_video', 'args': {'camera_name': '北卡口1号道相机'}, 'id': 'call_apnb8fiqdkaz313katcs3tjf', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('将大屏切换为2分屏'))
## [{'name': 'split_screen', 'args': {'split_n': 2}, 'id': 'call_2o7c94f591xag8p6lcyice9q', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('播放北卡口入境1号道录像,从今天到2025-03-16 02:09:31'))
## 由于大模型没有联网,所以无法判断‘今天’
## [{'name': 'play_video_record', 'args': {'camera_name': '北卡口入境1号道', 'start_time': '2023-10-25 00:00:00', 'end_time': '2025-03-16 02:09:31'}, 'id': 'call_6gllr9wofeaoomgiz13bgnk6', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('播放北卡口入境1号道录像,从25年3月1号到2号'))
## [{'name': 'play_video_record', 'args': {'camera_name': '北卡口入境1号道', 'start_time': '2025-03-01 00:00:00', 'end_time': '2025-03-02 23:59:59'}, 'id': 'call_qj78jpep6k5wjwo90dkrz4qt', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('播放北卡口入境1号从25年3月1号到2号的录像'))
## [{'name': 'play_video_record', 'args': {'camera_name': '北卡口入境1号相机', 'start_time': '2025-03-01 00:00:00', 'end_time': '2025-03-02 23:59:59'}, 'id': 'call_ixpyke880tdhopv27c6moci0', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('跳转到首页'))
## [{'name': 'switch_page', 'args': {'page_name': '首页'}, 'id': 'call_3ev11bjkyrqyzxaman3402az', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('打开日志'))
## [{'name': 'switch_page', 'args': {'page_name': '系统日志'}, 'id': 'call_acwy2yk7xz3bgpt28suujca2', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('放大地图到2级'))
## [{'name': 'zoom_in', 'args': {'level_n': 2}, 'id': 'call_ip1kang0lbr63y8gya8nrpwc', 'type': 'tool_call'}]
# print(dsr.invoke_with_tool('查看成都天府k00航班2004年1月1日入境预报航班人员明细'))
## [{'name': 'view_flight_details', 'args': {'airport_name': '成都天府机场', 'flight_code': 'K00', 'flight_date': '2004-01-01', 'ie_type': '入境'}, 'id': 'call_igummeorjq4r2pqjyr9tq6xq', 'type': 'tool_call'}]