lvwerra HF staff commited on
Commit
0f3cefd
·
verified ·
1 Parent(s): e9163a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -34,14 +34,17 @@ def execute_jupyter_agent(sytem_prompt, user_input, max_new_tokens):
34
  model = "meta-llama/Llama-3.1-8B-Instruct"
35
 
36
  sbx = Sandbox(api_key=E2B_API_KEY)
37
-
38
- messages = [
39
- {"role": "system", "content": sytem_prompt},
40
- {"role": "user", "content": user_input}
41
- ]
42
-
43
- for notebook_html, messages in run_interactive_notebook(client, model, messages, sbx, max_new_tokens=max_new_tokens):
44
- message_history = messages
 
 
 
45
  yield notebook_html
46
 
47
 
 
34
  model = "meta-llama/Llama-3.1-8B-Instruct"
35
 
36
  sbx = Sandbox(api_key=E2B_API_KEY)
37
+
38
+ if message_history = None:
39
+ message_history = [
40
+ {"role": "system", "content": sytem_prompt},
41
+ {"role": "user", "content": user_input}
42
+ ]
43
+ else:
44
+ message_history.append({"role": "user", "content": user_input})
45
+
46
+
47
+ for notebook_html, message_history in run_interactive_notebook(client, model, messages, sbx, max_new_tokens=max_new_tokens):
48
  yield notebook_html
49
 
50