Skip to content

请问这个代码function call部分是否存在问题 #4

Open
@abc-w

Description

@abc-w

根据代码逻辑,根据提示词大模型的答案只是生成code,与function call无关,function call run_code这部分一直不会执行,正确的逻辑应该是提取大模型生成的code,作为参数传入run_code?

/bin/python3 /home/pingchuan/codeinterpreter-codebox/examples/client/codeinterpreter_session.py
Internal Server Error
500
Message(content='As an AI language model, I don't have access to the uploaded file in the directory. However, you can use the following code to count the number of columns in the CSV file:\n\n\nimport pandas as pd\n\ndf = pd.read_csv(\'/codebox/test_data.csv\')\nnum_columns = len(df.columns)\n\nprint(f"The CSV file has {num_columns} columns.")\n\n\nPlease copy and paste this code into the run_code function to execute it on your local machine.', role='assistant', tool_calls=None, function_call=None)
close error
Traceback (most recent call last):
File "/home/pingchuan/codeinterpreter-codebox/examples/client/codeinterpreter_session.py", line 239, in
session.chat('上传的文件中有多少列数据')
File "/home/pingchuan/codeinterpreter-codebox/examples/client/codeinterpreter_session.py", line 205, in chat
if "function_call" in completion.keys() and 'run_code' == completion['function_call']['name']:
File "/home/pingchuan/.local/lib/python3.8/site-packages/pydantic/main.py", line 828, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'Message' object has no attribute 'keys'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions