Skip to content

Commit

Permalink
Remove print statements and comments from
Browse files Browse the repository at this point in the history
multi_agent_communication.py
  • Loading branch information
Appointat committed Nov 4, 2023
1 parent 2f8c4f4 commit 856cdbc
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions examples/multi_agent/multi_agent_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def main(model_type=ModelType.GPT_3_5_TURBO_16K, task_prompt=None,
role_descriptions_dict=role_descriptions_dict,
num_subtasks=9,
context_text=context_text)
print(
f"subtasks_with_dependencies_dict:\n{subtasks_with_dependencies_dict}")
oriented_graph = {}
for subtask_idx, details in subtasks_with_dependencies_dict.items():
deps = details["dependencies"]
Expand Down Expand Up @@ -202,11 +200,6 @@ def main(model_type=ModelType.GPT_3_5_TURBO_16K, task_prompt=None,
]
insights_pre_subtask += "\n".join(
[str(insight) for insight in retrieved_insights])
# print(Fore.CYAN + "Retrieved insights from the environment:\n" +
# f"{insights_pre_subtask}")
# print_and_write_md(
# "Retrieved insights from the environment:\n" +
# f"{insights_pre_subtask}", color=Fore.CYAN)
else:
insights_none_pre_subtask = insight_agent.run(
context_text=context_text)
Expand Down Expand Up @@ -299,14 +292,10 @@ def main(model_type=ModelType.GPT_3_5_TURBO_16K, task_prompt=None,
f"Reason: {user_response.info['termination_reasons']}."))
break

# print(Fore.BLUE + f"AI User: {ai_user_role}\n\n" +
# f"{user_response.msg.content}\n")
print_and_write_md(
f"AI User: {ai_user_role}\n\n" +
f"{user_response.msg.content}\n", color=Fore.BLUE,
MD_FILE=f"examples/multi_agent/{ID_one_subtask}.md")
# print(Fore.GREEN + f"AI Assistant: {ai_assistant_role}\n\n" +
# f"{assistant_response.msg.content}\n")
print_and_write_md(
f"AI Assistant: {ai_assistant_role}\n\n" +
f"{assistant_response.msg.content}\n", color=Fore.GREEN,
Expand All @@ -318,11 +307,6 @@ def main(model_type=ModelType.GPT_3_5_TURBO_16K, task_prompt=None,
# Generate the insights from the chat history
chat_history_assistant += (f"--- [{n}] ---\n"
f"{assistant_response.msg.content}\n")
# chat_history_two_roles += (f"--- [{n}] ---\n"
# f"[{ai_assistant_role}]:\n"
# f"{assistant_response.msg.content}\n\n\n"
# f"[{ai_user_role}]:\n"
# f"{user_response.msg.content}\n\n\n")
user_conversation = user_response.msg.content
assistant_conversation = assistant_response.msg.content.replace(
"Solution&Action:\n", "").replace("Next request.",
Expand Down Expand Up @@ -352,18 +336,21 @@ def main(model_type=ModelType.GPT_3_5_TURBO_16K, task_prompt=None,
"conversation itsel.")
insights = insight_agent.run(context_text=chat_history_assistant,
insights_instruction=insights_instruction)
# print(Fore.CYAN + "Insights from the chat history:\n" +
# f"{json.dumps(insights, indent=4)}")
# print_and_write_md(
# "Insights from the chat history:\n" +
# f"{json.dumps(insights, indent=4)}", color=Fore.CYAN)
insights_str = insight_agent.convert_json_to_str(insights)
insights_subtasks[ID_one_subtask] = insights_str
for insight in insights.values():
if insight["entity_recognition"] is None:
continue
labels_key = tuple(insight["entity_recognition"])
environment_record[labels_key] = insight
printable_environment_record = \
{str(label_tuple): insight_data
for label_tuple, insight_data in environment_record.items()}
print(Fore.CYAN + "Environment record:\n" +
f"{json.dumps(printable_environment_record, indent=4)}")
print_and_write_md(
"Environment record:\n" +
f"{json.dumps(printable_environment_record, indent=4)}", color=Fore.CYAN)


def print_and_write_md(text="", color=Fore.RESET, MD_FILE=None):
Expand Down

0 comments on commit 856cdbc

Please sign in to comment.