lvwerra HF staff commited on
Commit
69a9c5e
·
verified ·
1 Parent(s): 926febf

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +2 -2
utils.py CHANGED
@@ -153,7 +153,7 @@ def create_base_notebook(messages):
153
 
154
  elif message["role"] == "ipython":
155
  code_cell_counter +=1
156
- base_notebook["cells"][-1]["outputs"].append(message["content"])
157
  base_notebook["cells"][-1]["execution_count"] = code_cell_counter
158
 
159
  elif message["role"] == "assistant" and "tool_calls" not in message:
@@ -268,7 +268,7 @@ def run_interactive_notebook(client, model, messages, sbx, max_new_tokens=512):
268
  }
269
  }]
270
  })
271
- messages.append({"role": "ipython", "content": parse_exec_result_llm(execution)})
272
 
273
  # Update the last code cell with execution results
274
  notebook_data["cells"][-1]["outputs"] = parse_exec_result_nb(execution)
 
153
 
154
  elif message["role"] == "ipython":
155
  code_cell_counter +=1
156
+ base_notebook["cells"][-1]["outputs"].append(message["nbformat"])
157
  base_notebook["cells"][-1]["execution_count"] = code_cell_counter
158
 
159
  elif message["role"] == "assistant" and "tool_calls" not in message:
 
268
  }
269
  }]
270
  })
271
+ messages.append({"role": "ipython", "content": parse_exec_result_llm(execution), "nbformat": parse_exec_result_nb(execution)})
272
 
273
  # Update the last code cell with execution results
274
  notebook_data["cells"][-1]["outputs"] = parse_exec_result_nb(execution)