bstraehle commited on
Commit
88721b7
·
verified ·
1 Parent(s): 120abc4

Update multi_agent.py

Browse files
Files changed (1) hide show
  1. multi_agent.py +10 -5
multi_agent.py CHANGED
@@ -50,11 +50,16 @@ def run_multi_agent(llm, message):
50
  max_turns=10
51
  )
52
 
53
- chat_history = ""
54
-
55
- chat_result_json = json.loads(chat_result)
56
-
57
- for message in chat_result_json["messages"]:
 
 
 
 
 
58
  chat_history += f"Role: {message['role']}, Content: {message['content']}\n"
59
 
60
  image_data = read_image_file("/home/user/app/coding/ytd_stock_gains.png")
 
50
  max_turns=10
51
  )
52
 
53
+ chat_history_dict = chat_result.to_dict()
54
+
55
+ # Convert the dictionary to a JSON string
56
+ chat_history_json = json.dumps(chat_history_dict)
57
+
58
+ # Parse the JSON string
59
+ chat_history_parsed = json.loads(chat_history_json)
60
+
61
+ # Iterate over the messages and print the role and content
62
+ for message in chat_history_parsed["messages"]:
63
  chat_history += f"Role: {message['role']}, Content: {message['content']}\n"
64
 
65
  image_data = read_image_file("/home/user/app/coding/ytd_stock_gains.png")