diff --git a/autogen_updates_0_2_27/OAI_CONFIG_LIST.json b/autogen_updates_0_2_27/OAI_CONFIG_LIST.json new file mode 100644 index 0000000..6b60acb --- /dev/null +++ b/autogen_updates_0_2_27/OAI_CONFIG_LIST.json @@ -0,0 +1,6 @@ +[ + { + "model": "gpt-4", + "api_key": "sk-proj-1111" + } +] \ No newline at end of file diff --git a/autogen_updates_0_2_27/code/home.html b/autogen_updates_0_2_27/code/home.html new file mode 100644 index 0000000..bdc5a71 --- /dev/null +++ b/autogen_updates_0_2_27/code/home.html @@ -0,0 +1,13 @@ + + + + + + + + + +

Welcome to the Home Page

+ + + \ No newline at end of file diff --git a/autogen_updates_0_2_27/code/index.html b/autogen_updates_0_2_27/code/index.html new file mode 100644 index 0000000..d3eeebd --- /dev/null +++ b/autogen_updates_0_2_27/code/index.html @@ -0,0 +1,13 @@ + + + + + + + +

Welcome to the Homepage!

+ + + + + \ No newline at end of file diff --git a/autogen_updates_0_2_27/code/script.js b/autogen_updates_0_2_27/code/script.js new file mode 100644 index 0000000..2ddcdb0 --- /dev/null +++ b/autogen_updates_0_2_27/code/script.js @@ -0,0 +1,7 @@ +// filename: script.js + +window.onload = function() { + document.getElementById("helloButton").onclick = function() { + alert("Hello!"); + } +}; \ No newline at end of file diff --git a/autogen_updates_0_2_27/code/style.css b/autogen_updates_0_2_27/code/style.css new file mode 100644 index 0000000..65578b1 --- /dev/null +++ b/autogen_updates_0_2_27/code/style.css @@ -0,0 +1,23 @@ +/* filename: style.css */ + +body { + background-color: lightblue; +} + +h1 { + color: white; + text-align: center; +} + +#helloButton { + display: block; + width: 200px; + height: 50px; + margin: 20px auto; + background-color: #4CAF50; + color: white; + padding: 14px 28px; + font-size: 16px; + cursor: pointer; + text-align: center; +} \ No newline at end of file diff --git a/autogen_updates_0_2_27/code/styles.css b/autogen_updates_0_2_27/code/styles.css new file mode 100644 index 0000000..da31077 --- /dev/null +++ b/autogen_updates_0_2_27/code/styles.css @@ -0,0 +1,22 @@ +# filename: styles.css +body { + background-color: lightblue; +} + +h1 { + color: white; + text-align: center; +} + +#my_button { + display: block; + width: 200px; + height: 50px; + margin: 20px auto; + background-color: #4CAF50; + color: white; + text-align: center; + line-height: 50px; + font-size: 20px; + cursor: pointer; +} \ No newline at end of file diff --git a/autogen_updates_0_2_27/dotnet-autogen.cs b/autogen_updates_0_2_27/dotnet-autogen.cs new file mode 100644 index 0000000..038e481 --- /dev/null +++ b/autogen_updates_0_2_27/dotnet-autogen.cs @@ -0,0 +1,29 @@ +using AutoGen; +using AutoGen.Core; +using AutoGen.OpenAI; + + +var openAIKey = "your-api-key"; +var gpt35Config = new OpenAIConfig(openAIKey, "gpt-3.5-turbo"); + +var assistantAgent = new AssistantAgent( + name: "assistant", + systemMessage: "You are an assistant that help user to do some tasks.", + llmConfig: new ConversableAgentConfig + { + Temperature = 0, + ConfigList = [gpt35Config], + }) + .RegisterPrintMessage(); // register a hook to print message nicely to console + +// set human input mode to ALWAYS so that user always provide input +var userProxyAgent = new UserProxyAgent( + name: "user", + humanInputMode: HumanInputMode.ALWAYS) + .RegisterPrintMessage(); + +// start the conversation +await userProxyAgent.InitiateChatAsync( + receiver: assistantAgent, + message: "Hey assistant, please do me a favor.", + maxRound: 10); diff --git a/autogen_updates_0_2_27/main.py b/autogen_updates_0_2_27/main.py new file mode 100644 index 0000000..78d0433 --- /dev/null +++ b/autogen_updates_0_2_27/main.py @@ -0,0 +1,47 @@ +import autogen +from autogen.coding import LocalCommandLineCodeExecutor + + +def main(): + config_list = autogen.config_list_from_json( + env_or_file="OAI_CONFIG_LIST.json" + ) + + # Create a local command line code executor. + executor = LocalCommandLineCodeExecutor( + timeout=10, + work_dir="code", + ) + + assistant = autogen.AssistantAgent( + name="Assistant", + llm_config={ + "config_list": config_list + }, + system_message="If you want the user to save the code in a file before executing it, put # filename: " + " inside the code block as the first line. You are a helpful assistant. Return " + "'TERMINATE' when the task is done." + ) + + user_proxy = autogen.UserProxyAgent( + name="user", + human_input_mode="NEVER", + is_termination_msg=lambda msg: msg.get("content") is not None and "TERMINATE" in msg["content"], + code_execution_config={"executor": executor}, + ) + + # trying this out with saving html file! + user_proxy.initiate_chat( + assistant, + message=""" + Create a simple html that opens a simple home page and stylize it + with some css and save that in a separate file. Create a simple + button on the html page that when clicked, just displays 'Hello!'. + You can also create a javascript file to make this happen. + Make sure to comment out the file names at the top of each file. + """ + ) + + +if __name__ == "__main__": + main() \ No newline at end of file