Yasu777 commited on
Commit
7f9afcf
·
1 Parent(s): 68e9b82

Update third.py

Browse files
Files changed (1) hide show
  1. third.py +5 -4
third.py CHANGED
@@ -2,6 +2,7 @@
2
 
3
  import os
4
  import openai
 
5
  from langchain.chat_models import ChatOpenAI
6
  from langchain.experimental.plan_and_execute import PlanAndExecute, load_agent_executor, load_chat_planner
7
  from langchain.llms import OpenAI
@@ -63,13 +64,13 @@ async def main(editable_output2, keyword_id):
63
  agent_output = agent.run(instruction)
64
  executed_instructions.append(instruction)
65
 
 
 
 
66
  # Extract the response content directly from the agent's output
67
- response_content = agent_output['action_input']
68
  research_results.append(response_content)
69
 
70
- else:
71
- response_content = "This instruction has already been executed."
72
-
73
  # Prepare the system message
74
  system_message = {
75
  "role": "system",
 
2
 
3
  import os
4
  import openai
5
+ import json
6
  from langchain.chat_models import ChatOpenAI
7
  from langchain.experimental.plan_and_execute import PlanAndExecute, load_agent_executor, load_chat_planner
8
  from langchain.llms import OpenAI
 
64
  agent_output = agent.run(instruction)
65
  executed_instructions.append(instruction)
66
 
67
+ # Convert the agent_output string to a Python dictionary
68
+ agent_output_dict = json.loads(agent_output)
69
+
70
  # Extract the response content directly from the agent's output
71
+ response_content = agent_output_dict['action_input']
72
  research_results.append(response_content)
73
 
 
 
 
74
  # Prepare the system message
75
  system_message = {
76
  "role": "system",