Skip to content

Instantly share code, notes, and snippets.

@rayanfer32
Created October 25, 2023 06:55
Show Gist options
  • Save rayanfer32/6bf8c6e4dfabea1acd872d280ff7570d to your computer and use it in GitHub Desktop.
Save rayanfer32/6bf8c6e4dfabea1acd872d280ff7570d to your computer and use it in GitHub Desktop.
autogen-example.py
import autogen
config_list = [{
'api_type': 'open_ai',
'api_base': "http://172.18.240.1:1234/v1",
'api_key': "NULL",
}]
llm_config = {
'request_timeout': 600,
'seed': 42,
'config_list': config_list,
'temperature': 0,
}
assistant = autogen.AssistantAgent(
name="assistant",
system_message="You are a code specializing in Python.",
llm_config=llm_config
)
user_proxy = autogen.UserProxyAgent(
name="user_proxy",
llm_config=llm_config,
human_input_mode="NEVER",
max_consecutive_auto_reply=10,
is_termination_msg=lambda x: x.get(
"content", "").rstrip().endswith("TERMINATE"),
code_execution_config={
'work_dir': 'coding',
'use_docker': False
},
system_message="Reply TERMINATE if the task has been solved at full satisfaction. Otherwise, Reply CONTINUE, or the reason why the task is not solved yet.",
)
task = """
Write a python code to sum all the numbers in an array
"""
user_proxy.initiate_chat(assistant, message=task)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment