Yasu777 commited on
Commit
3f463c6
·
1 Parent(s): 7f9afcf

Update third.py

Browse files
Files changed (1) hide show
  1. third.py +9 -7
third.py CHANGED
@@ -57,19 +57,21 @@ async def main(editable_output2, keyword_id):
57
  purpose = f"about {h1_text}, focusing particularly on {' and '.join(h2_texts)} and {' and '.join(h3_texts)}, to investigate the latest information and details"
58
 
59
  # Convert the purpose into an instruction in the form of a question.
60
- instruction = f"Can you research {purpose} and include specific details such as names, ages, careers, product names, service names, store names, locations, times, and any relevant numerical data or statistics in your response?"
61
 
62
  # Run the instruction with a clear expectation of the output format
63
  if instruction not in executed_instructions:
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 = {
 
57
  purpose = f"about {h1_text}, focusing particularly on {' and '.join(h2_texts)} and {' and '.join(h3_texts)}, to investigate the latest information and details"
58
 
59
  # Convert the purpose into an instruction in the form of a question.
60
+ instruction = f"Can you research {purpose} and include specific details in your response?"
61
 
62
  # Run the instruction with a clear expectation of the output format
63
  if instruction not in executed_instructions:
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 = {