Repro steps
- Create assistant (I was using gpt-4-turbo)
- Give csv file to code interpreter containing data that can be used to create charts
- Enable code interpreter
- Enable streaming
- Request assistant to create bar chart of the data in csv file
Result
Code interpreter starts to generate chart like output below, but ends the run too early, without providing the bar chart
user: please provide bar chart on METALS & MINING sector on operating profit and provide link to me?
assistant_v22: The dataset contains financial data for various companies listed under different sectors. The fields include the company's name, sector, revenue, operating expenses, operating profit, and more.
Now, I will filter the dataset for companies in the 'METALS & MINING' sector and create a bar chart showing their Operating Profit.
The output of code interpreter final on_tool_call_done is as follows:
2024-05-01 16:59:36,547 - INFO - on_tool_call_done - on_tool_call_done called, tool_call: CodeInterpreterToolCall(id=‘call_OBEo01SGUahHdVR8kysbW55F’, code_interpreter=CodeInterpreter(input=“import matplotlib.pyplot as plt\n\n# Filter data for ‘METALS & MINING’ sector\nmetals_mining_data = data[data[‘sector’] == ‘METALS & MINING’]\n\n# Convert ‘operating_profit’ to float after removing commas\nmetals_mining_data[‘operating_profit’] = metals_mining_data[‘operating_profit’].replace(‘,’, ‘’, regex=True).astype(float)\n\n# Create a bar chart\nplt.figure(figsize=(10, 6))\nplt.bar(metals_mining_data[‘name’], metals_mining_data[‘operating_profit’], color=‘teal’)\nplt.xlabel(‘Company Name’)\nplt.ylabel(‘Operating Profit (in million)’)\nplt.title(‘Operating Profit of Companies in METALS & MINING Sector’)\nplt.xticks(rotation=45, ha=‘right’)\nplt.tight_layout()\nplt.show()”, outputs=[CodeInterpreterOutputLogs(logs=“/tmp/ipykernel_12/2141688280.py:7: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: Indexing and selecting data — pandas 2.2.2 documentation metals_mining_data[‘operating_profit’] = metals_mining_data[‘operating_profit’].replace(‘,’, ‘’, regex=True).astype(float)\n”, type=‘logs’, index=0)]), type=‘code_interpreter’, index=0)
2024-05-01 16:59:36,802 - INFO - on_end - on_end called, run_id: run_2sO3wgChvX8IAMIQ4cjwOceD, is_submit_tool_call: False
Additional information
thread_ukAj3CMwb4TCEJS99JzK5q7I
Repro rate: 100%
I wonder, is there a need to submit tool call outputs for code interpreter?
By looking the API constructs, I see submit tool outputs is only for functions.