Created
July 21, 2024 12:16
-
-
Save bizrockman/12237c82500eb51ec46120652dc8ada3 to your computer and use it in GitHub Desktop.
AutoGen - OpenAI Assistant
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
import os | |
from autogen import UserProxyAgent | |
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent | |
os.environ["AUTOGEN_USE_DOCKER"] = "False" | |
config_list = [ | |
{ | |
"model": "gpt-4o", | |
"api_key": "sk-..." | |
} | |
] | |
gpt_assistant = GPTAssistantAgent( | |
name="assistant", | |
llm_config={ | |
"config_list": config_list, | |
"cache_seed": None, | |
"assistant_id": None | |
}) | |
user_proxy = UserProxyAgent(name="user_proxy", | |
code_execution_config={ | |
"work_dir": "coding" | |
}, | |
is_termination_msg=lambda msg: "TERMINATE" in msg["content"], | |
human_input_mode="NEVER") | |
user_proxy.initiate_chat(gpt_assistant, message="Print hello world") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment