Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function calling的问题 #5

Open
miaohuil opened this issue Oct 7, 2024 · 1 comment
Open

function calling的问题 #5

miaohuil opened this issue Oct 7, 2024 · 1 comment

Comments

@miaohuil
Copy link

miaohuil commented Oct 7, 2024

模型找到了需要调用的function,但无法完成后续操作,日志如下:
2024-10-07 22:54:33,963 - bailing.robot - INFO - Started recording.
2024-10-07 22:54:38,070 - bailing.vad - DEBUG - VAD output: {'start': 58912}
2024-10-07 22:54:39,800 - bailing.vad - DEBUG - VAD output: {'end': 83936}
2024-10-07 22:54:39,801 - bailing.robot - DEBUG - 语音包的长度:172
2024-10-07 22:54:39,811 - bailing.asr - INFO - ASR识别文件录音保存到:tmp/[email protected]_avg: 0.119: 100%|█████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.52it/s]
2024-10-07 22:54:40,474 - bailing.asr - INFO - 识别文本: 今天星期几?
2024-10-07 22:54:40,475 - bailing.robot - DEBUG - ASR识别结果: 今天星期几?
2024-10-07 22:54:40,477 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 127.0.0.1:5000
2024-10-07 22:54:40,480 - urllib3.connectionpool - DEBUG - http://127.0.0.1:5000 "POST /add_message HTTP/11" 200 26
2024-10-07 22:54:40,481 - main - INFO - {
"status": "success"
}

2024-10-07 22:54:40,490 - openai._base_client - DEBUG - Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'json_data': {'messages': [{'role': 'system', 'content': '# 角色定义\n你是百聆,由寒江雪开发。你性格开朗、活泼,善
于交流。你的回复应该简短、友好、口语化强一些,回复禁止出现表情符号。\n\n#以下是历史对话摘要:\n\n\n# 回复要求\n1. 你的回复应该
简短、友好、口语化强一些,回复禁止出现表情符号。\n2. 如果需要调用工具,先不要回答,调用工具后再回答,直接输出工具名和参数,输
出格式json\n{"function_name":"", "args":{}}'}, {'role': 'user', 'content': '今天星期几?'}], 'model': 'deepseek-chat',
'stream': True, 'tools': [{'type': 'function', 'function': {'name': 'get_weather', 'description': '获取某个地点的天气,用户应
先提供一个位置,比如用户说杭州天气,参数为:zhejiang/hangzhou,比如用户说北京天气怎么样,参数为:beijing/beijing', 'parameters': {'type': 'object', 'properties': {'city': {'type': 'string', 'description': '城市,zhejiang/hangzhou'}}, 'required': ['city']}}}, {'type': 'function', 'function': {'name': 'ielts_speaking_practice', 'description': "提供雅思口语练习的题目和建议,
用户可以请求特定主题的练习,例如:'请给我一个旅游主题的雅思口语题", 'parameters': {'type': 'object', 'properties': {'topic':
{'type': 'string', 'description': '练习主题,例如:旅游、工作、教育等'}}, 'required': []}}}, {'type': 'function', 'function': {'name': 'get_day_of_week', 'description': '获取当前日期的星期几,用户可以询问当前日期或时间,参数为空,因为函数自动获取当前
时间', 'parameters': {'type': 'object', 'properties': {}, 'required': []}}}, {'type': 'function', 'function': {'name': 'schedule_task', 'description': "创建一个定时任务,用户应提供任务的执行时间和任务内容。\n比如用户说每天早上8点提醒我喝水,参数为:time: '08:00', content: '提醒我喝水'。", 'parameters': {'type': 'object', 'properties': {'time': {'type': 'string', 'description': "任务的执行时间,格式为HH:mm,比如'08:00'表示早上8点。"}, 'content': {'type': 'string', 'description': "任务的内容,比如
'提醒我喝水'。"}}, 'required': ['time', 'content']}}}, {'type': 'function', 'function': {'name': 'open_application', 'description': "在 Mac 电脑上打开指定的应用程序,用户应提供应用程序的名称。\n比如用户说打开Safari,参数为:application_name: 'Safari'。", 'parameters': {'type': 'object', 'properties': {'application_name': {'type': 'string', 'description': "应用程序的名称,
比如'Safari'、'Finder'、'Notes'等。"}}, 'required': ['application_name']}}}, {'type': 'function', 'function': {'name': 'web_search', 'description': "在网上搜索指定的关键词,用户应提供搜索内容。\n比如用户说搜索'最新的科技新闻',参数为:query: '最新的
科技新闻'。", 'parameters': {'type': 'object', 'properties': {'query': {'type': 'string', 'description': "搜索关键词,比如'最
新的科技新闻'、'Python编程教程'等。"}}, 'required': ['query']}}}, {'type': 'function', 'function': {'name': 'search_local_documents', 'description': "查询本地文档,用户需提供查询关键词,返回匹配的文档列表,例如用户说'查找关于机器学习的文档',参数为:
{'keyword': '机器学习'}", 'parameters': {'type': 'object', 'properties': {'keyword': {'type': 'string', 'description': "查询
关键词,例如:'机器学习'、'Python编程'等"}}, 'required': ['keyword']}}}]}}
2024-10-07 22:54:40,512 - openai._base_client - DEBUG - Sending HTTP Request: POST https://api.deepseek.com/chat/completions
2024-10-07 22:54:40,513 - httpcore.connection - DEBUG - connect_tcp.started host='127.0.0.1' port=10809 local_address=None timeout=5.0 socket_options=None
2024-10-07 22:54:40,514 - httpcore.connection - DEBUG - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x0000013F9FF31A50>
2024-10-07 22:54:40,515 - httpcore.http11 - DEBUG - send_request_headers.started request=<Request [b'CONNECT']>
2024-10-07 22:54:40,515 - httpcore.http11 - DEBUG - send_request_headers.complete
2024-10-07 22:54:40,516 - httpcore.http11 - DEBUG - send_request_body.started request=<Request [b'CONNECT']>
2024-10-07 22:54:40,516 - httpcore.http11 - DEBUG - send_request_body.complete
2024-10-07 22:54:40,516 - httpcore.http11 - DEBUG - receive_response_headers.started request=<Request [b'CONNECT']>
2024-10-07 22:54:40,516 - httpcore.http11 - DEBUG - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'Connection established', [])
2024-10-07 22:54:40,516 - httpcore.proxy - DEBUG - start_tls.started ssl_context=<ssl.SSLContext object at 0x0000013F9FE83DC0> server_hostname='api.deepseek.com' timeout=5.0
2024-10-07 22:54:41,493 - httpcore.proxy - DEBUG - start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x0000013F9FF31A20>
2024-10-07 22:54:41,494 - httpcore.http11 - DEBUG - send_request_headers.started request=<Request [b'POST']>
2024-10-07 22:54:41,495 - httpcore.http11 - DEBUG - send_request_headers.complete
2024-10-07 22:54:41,495 - httpcore.http11 - DEBUG - send_request_body.started request=<Request [b'POST']>
2024-10-07 22:54:41,496 - httpcore.http11 - DEBUG - send_request_body.complete
2024-10-07 22:54:41,496 - httpcore.http11 - DEBUG - receive_response_headers.started request=<Request [b'POST']>
2024-10-07 22:54:41,947 - httpcore.http11 - DEBUG - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK',
[(b'Server', b'nginx/1.18.0 (Ubuntu)'), (b'Date', b'Mon, 07 Oct 2024 14:54:42 GMT'), (b'Content-Type', b'text/event-stream; charset=utf-8'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'Set-Cookie', b'HWWAFSESID=f31c22ad297ba3652dc; path=/'), (b'Set-Cookie', b'HWWAFSESTIME=1728312878807; path=/'), (b'cache-control', b'no-cache'), (b'x-ratelimit-limit', b'200'), (b'x-ratelimit-remaining', b'199'), (b'x-ds-request-id', b'6d365e8b-aed9-42db-840e-ec64644f7e1d'), (b'vary', b'origin, access-control-request-method, access-control-request-headers'), (b'access-control-allow-credentials', b'true'), (b'x-ds-trace-id', b'cfc8f6f48350f92dad21ceb7685bd938')])
2024-10-07 22:54:41,949 - httpx - INFO - HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2024-10-07 22:54:41,949 - openai._base_client - DEBUG - HTTP Response: POST https://api.deepseek.com/chat/completions "200 OK" Headers([('server', 'nginx/1.18.0 (Ubuntu)'), ('date', 'Mon, 07 Oct 2024 14:54:42 GMT'), ('content-type', 'text/event-stream; charset=utf-8'), ('transfer-encoding', 'chunked'), ('connection', 'keep-alive'), ('set-cookie', 'HWWAFSESID=f31c22ad297ba3652dc; path=/'), ('set-cookie', 'HWWAFSESTIME=1728312878807; path=/'), ('cache-control', 'no-cache'), ('x-ratelimit-limit', '200'), ('x-ratelimit-remaining', '199'), ('x-ds-request-id', '6d365e8b-aed9-42db-840e-ec64644f7e1d'), ('vary', 'origin, access-control-request-method, access-control-request-headers'), ('access-control-allow-credentials', 'true'), ('x-ds-trace-id', 'cfc8f6f48350f92dad21ceb7685bd938')])
2024-10-07 22:54:41,950 - openai._base_client - DEBUG - request_id: None
2024-10-07 22:54:41,950 - httpcore.http11 - DEBUG - receive_response_body.started request=<Request [b'POST']>
2024-10-07 22:54:43,676 - httpcore.http11 - DEBUG - receive_response_body.complete
2024-10-07 22:54:43,677 - httpcore.http11 - DEBUG - response_closed.started
2024-10-07 22:54:43,677 - httpcore.http11 - DEBUG - response_closed.complete
2024-10-07 22:54:43,678 - bailing.robot - INFO - function_name=get_day_of_week, function_id=de151d6e860b4bc49aee2684052d75ce, function_arguments={}
就一直停在这里不动了

@miaohuil
Copy link
Author

修改get_day_of_week可以往下运行了:
将# response = f"当前日期: {current_date},当前时间: {current_time.strftime('%H点%M分%秒')},星期几: {weekday_name}"
修改为:response = f"当前日期: {current_date},当前时间: {current_time.strftime('%H:%M:%S')},星期几: {weekday_name}"

Repository owner deleted a comment from hjxbin Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant