Yasu777 commited on
Commit
55ff225
·
1 Parent(s): 3f463c6

Update third.py

Browse files
Files changed (1) hide show
  1. third.py +17 -7
third.py CHANGED
@@ -64,15 +64,25 @@ async def main(editable_output2, keyword_id):
64
  raw_output = agent.run(instruction)
65
  executed_instructions.append(instruction)
66
 
67
- # エージェント出力JSONとして解析
68
- agent_output = json.loads(raw_output)
69
-
70
- # 'action_input'を取得
71
- response_content = agent_output['action']['action_input']
72
- research_results.append(response_content)
 
 
 
 
 
 
 
 
 
 
73
  else:
74
  response_content = "This instruction has already been executed."
75
-
76
  # Prepare the system message
77
  system_message = {
78
  "role": "system",
 
64
  raw_output = agent.run(instruction)
65
  executed_instructions.append(instruction)
66
 
67
+ # raw_output内容確認
68
+ print(f"Raw Output: {raw_output}")
69
+
70
+ try:
71
+ # エージェントの出力をJSONとして解析
72
+ agent_output = json.loads(raw_output)
73
+
74
+ # 'action_input'を取得
75
+ response_content = agent_output['action']['action_input']
76
+ research_results.append(response_content)
77
+ except json.JSONDecodeError:
78
+ print("Error: Could not decode the agent's output as JSON.")
79
+ return
80
+ except Exception as e:
81
+ print(f"Error: {e}")
82
+ return
83
  else:
84
  response_content = "This instruction has already been executed."
85
+
86
  # Prepare the system message
87
  system_message = {
88
  "role": "system",