Skip to content

Commit

Permalink
added simple password service that writes code for completion (still …
Browse files Browse the repository at this point in the history
…working on)
  • Loading branch information
tylerprogramming committed Jan 17, 2024
1 parent 563a54f commit ef8e363
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
6 changes: 6 additions & 0 deletions saas_products/password/OAI_CONFIG_LIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"model": "gpt-3.5-turbo",
"api_key": "sk-1111"
}
]
62 changes: 62 additions & 0 deletions saas_products/password/password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import autogen

config_list = autogen.config_list_from_json(
"OAI_CONFIG_LIST",
filter_dict={
"model": ["gpt-3.5-turbo"],
},
)

llm_config = {
"config_list": config_list,
"seed": 42,
"temperature": 0.7,
"timeout": 300
}

user_proxy = autogen.UserProxyAgent(
name="Admin",
system_message="A human admin. Interact with the planner to discuss the plan. Plan execution needs to be approved "
"by this admin.",
human_input_mode="TERMINATE",
code_execution_config={"last_n_messages": 3, "work_dir": "programming"},
)

engineer = autogen.AssistantAgent(
name="Engineer",
llm_config=llm_config,
)

planner = autogen.AssistantAgent(
name="Planner",
system_message='''Planner. Suggest a plan. Revise the plan based on feedback from admin and critic, until admin
approval. The plan may involve an engineer who can write code and an executor and critic who doesn't write code.
Explain the plan first. Be clear which step is performed by an engineer, executor, and critic.''',
llm_config=llm_config,
)

executor = autogen.AssistantAgent(
name="Executor",
system_message="Executor. Execute the code written by the engineer and report the result. Once you execute the "
"code, save it into a proper file under the correct directory.",
llm_config=llm_config
)

critic = autogen.AssistantAgent(
name="Critic",
system_message="Critic. Double check plan, claims, code from other agents and provide feedback. You don't "
"execute code, just provide feedback.",
llm_config=llm_config,
)

groupchat = autogen.GroupChat(agents=[user_proxy, engineer, planner, executor, critic], messages=[], max_round=20)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)

user_proxy.initiate_chat(manager, message="I would like to build a simple application that allows me to call an api "
"to encrypt a message, which will be in the form of a string, and use the "
"RSA encryption algorithm. Then this encrypted message should be stored in "
"a database table called Messages, which takes an id and then the column "
"for the message. There should be another API that can be called to "
"retrieve the message based on an id, then grab the associated encrypted "
"message, decrypt it also using RSA and return the decrypted message. Can "
"you create this as a flask application?")

0 comments on commit ef8e363

Please sign in to comment.