Skip to content

Instantly share code, notes, and snippets.

@bizrockman
Created July 21, 2024 12:16
Show Gist options
  • Save bizrockman/12237c82500eb51ec46120652dc8ada3 to your computer and use it in GitHub Desktop.
Save bizrockman/12237c82500eb51ec46120652dc8ada3 to your computer and use it in GitHub Desktop.
AutoGen - OpenAI Assistant
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