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

IndexError: list index out of range #16

Open
Ice-Hazymoon opened this issue Jul 7, 2023 · 12 comments
Open

IndexError: list index out of range #16

Ice-Hazymoon opened this issue Jul 7, 2023 · 12 comments

Comments

@Ice-Hazymoon
Copy link

运行 main.py 后

问题:今天的可孚医疗股价是多少

===============================Intent Detecting===========================================
2023-07-07 12:19:09
new_instruction: 今天的日期是2023-07-06,请帮我查询可孚医疗今天的股价。
===============================Task Planing===========================================
2023-07-07 12:19:11
stock_task : 获取可孚医疗今天的股价数据
===============================Tool select and using Stage===========================================
2023-07-07 12:19:13
==================


step: step1=
content: {
 "arg1": ["可孚医疗","20220720","20220720","daily"],
 "function1": "get_stock_prices_data",
 "output1": "result1",
 "description1": "可孚医疗今日股价数据"
}
It has parallel steps: 1.0
parallel step: 1
===============================Visualization Stage===========================================
Traceback (most recent call last):
  File "/root/Data-Copilot/main.py", line 381, in <module>
    output, image, df , output_result = run(instruction, send_chat_request_Azure = openai_call, openai_key=openai_key, api_base='', engine='')
  File "/root/Data-Copilot/main.py", line 267, in run
    task_name = list(task_plan.keys())[1].split('_task')[0] #visualization_task
IndexError: list index out of range
@zwq2018
Copy link
Owner

zwq2018 commented Jul 7, 2023

当天的数据要在晚上才能更新,你换个request

@Ice-Hazymoon
Copy link
Author

输出可孚医疗上周三的股价

2023-07-07 19:13:54
Traceback (most recent call last):
  File "/root/Data-Copilot/main.py", line 381, in <module>
    output, image, df , output_result = run(instruction, send_chat_request_Azure = openai_call, openai_key=openai_key, api_base='', engine='')
  File "/root/Data-Copilot/main.py", line 215, in run
    call_steps, _ = response.split('###')
ValueError: not enough values to unpack (expected 2, got 1)

@zwq2018
Copy link
Owner

zwq2018 commented Jul 7, 2023

请不要用周三这种词,因为时区问题,我们的周三就是美国的周二。这样会引起LLMs误会。请直接用日期,例如输出可孚医疗7月4日股价

@Ice-Hazymoon
Copy link
Author

===============================Intent Detecting===========================================
2023-07-07 21:10:24
new_instruction: 输出可孚医疗2023年7月4日的股价
===============================Task Planing===========================================
2023-07-07 21:10:26
stock_task : 获取可孚医疗20230704的股价数据
visualization_task : 输出可孚医疗20230704的股价
===============================Tool select and using Stage===========================================
2023-07-07 21:10:29
Traceback (most recent call last):
  File "/root/Data-Copilot/main.py", line 381, in <module>
    output, image, df , output_result = run(instruction, send_chat_request_Azure = openai_call, openai_key=openai_key, api_base='', engine='')
  File "/root/Data-Copilot/main.py", line 215, in run
    call_steps, _ = response.split('###')
ValueError: not enough values to unpack (expected 2, got 1)

@Ice-Hazymoon
Copy link
Author

version: 2409228
Python 3.10.0
WSL: 1.2.5.0
OS: Ubuntu 20.04 LTS

@zwq2018
Copy link
Owner

zwq2018 commented Jul 7, 2023

我这边测试过是没问题。你到demo里试试应该也是可以的。你可以查下381行输出response是啥

@zwq2018
Copy link
Owner

zwq2018 commented Jul 7, 2023

call_steps, _ = response.split('###') 这句话是把openai回复的response取出来解析,你看看它有没有内容

@Ice-Hazymoon
Copy link
Author

result_buffer=> {}
output_buffer=> ['result1']
Traceback (most recent call last):
  File "/root/Data-Copilot/main.py", line 388, in <module>
    output, image, df , output_result = run(instruction, send_chat_request_Azure = openai_call, openai_key=openai_key, api_base='', engine='')
  File "/root/Data-Copilot/main.py", line 283, in run
    Previous_result[rename] = result_buffer[output_name][1]
KeyError: 'result1'

@Ice-Hazymoon
Copy link
Author

看起来 prompt 的输出限制不太稳定,有时候能进到

call_steps, _ = response.split('###')

有时候在
for output_name in output_buffer:
这部分就报错

result_buffer=> {'result1': (  stock_code trade_date       open      high       low      close  ...  symbol  stock_name  area  industry  market  list_date
0  301087.SZ   20230705  64.681059  66.18079  64.39212  65.424045  ...  301087        可孚医疗    湖南      医疗保健     创业板   20211025

[1 rows x 18 columns], '可孚医疗20230705的股价数据')}
output_buffer=> ['result1']
response =>
2023-07-07 22:04:00
step1={
 "arg": ["input1"],
 "function": "print",
 "output": "result1",
 "description": "输出可孚医疗20230705的股价"
}
response end

出现错误:

Traceback (most recent call last):
  File "/root/Data-Copilot/main.py", line 388, in <module>
    output, image, df , output_result = run(instruction, send_chat_request_Azure = openai_call, openai_key=openai_key, api_base='', engine='')
  File "/root/Data-Copilot/main.py", line 298, in run
    call_steps, _ = response.split('###')
ValueError: not enough values to unpack (expected 2, got 1)

@Ice-Hazymoon
Copy link
Author

我使用的是 OpenAI 的 key,tushare 积分 120,每日股票数据接口应该是能用的,但是没一次能调用成功。

@zwq2018
Copy link
Owner

zwq2018 commented Jul 7, 2023

咦 按理说这么简单的request应该还蛮稳定。我刚自己试了几次都正常。你加我17681825398

@programmermw1986
Copy link

image
image
获取的stock_data列名好像和代码里面的没有对齐 这个是什么原因

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

3 participants