Spaces:
Sleeping
Sleeping
Update third.py
Browse files
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
|
| 61 |
|
| 62 |
# Run the instruction with a clear expectation of the output format
|
| 63 |
if instruction not in executed_instructions:
|
| 64 |
-
|
| 65 |
executed_instructions.append(instruction)
|
| 66 |
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
#
|
| 71 |
-
response_content =
|
| 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 = {
|