forked from tylerprogramming/ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added simple password service that writes code for completion (still …
…working on)
- Loading branch information
1 parent
563a54f
commit ef8e363
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[ | ||
{ | ||
"model": "gpt-3.5-turbo", | ||
"api_key": "sk-1111" | ||
} | ||
] |
This file contains 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
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?") |