Created
October 18, 2024 04:59
-
-
Save rominirani/6ceb61557fddb4ebcaac9af3c935a005 to your computer and use it in GitHub Desktop.
multi-agent-101.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from autogen import ConversableAgent | |
import autogen | |
config_list_gemini = autogen.config_list_from_json("model_config.json") | |
quote_writer = ConversableAgent( | |
name="Quote Generator", | |
system_message="Your task is to provide famous quotes", | |
llm_config = {"config_list" : config_list_gemini}, | |
code_execution_config = False, | |
human_input_mode = "NEVER", | |
silent=True, | |
) | |
quote_reviewer = ConversableAgent( | |
name="Quote Reviewer", | |
system_message="Your task is to review a famous quote and provide your comments briefly in a list.", | |
llm_config = {"config_list" : config_list_gemini}, | |
code_execution_config = False, | |
human_input_mode = "NEVER", | |
silent=True, | |
) | |
reply = quote_writer.generate_reply(messages=[{"content": "Give me a quote by Albert Einstein", "role": "user"}]) | |
result = quote_writer.initiate_chat(quote_reviewer,message=reply['content'], | |
max_turns=2, | |
summary_method="reflection_with_llm",) | |
print(result.summary["content"]) | |
print(result.chat_history) | |
print(result.cost) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment