mirror of
https://github.com/microsoft/autogen.git
synced 2025-09-26 00:24:26 +00:00

* 1) Removed most framework sleeps 2) refactored connection code * pre-commit fixes * pre-commit * ignore protobuf files in pre-commit checks * Fix duplicate actor registration * refactor change * Nicer printing of Actors * 1) Report recv_multipart errors 4) Always send 4 parts * AutoGen generate_reply expects to wait indefinitely for an answer. CAP can wait a certain amount and give up. In order to reconcile the two, AutoGenConnector is set to wait indefinitely. * pre-commit formatting fixes * pre-commit format changes * don't check autogenerated proto py files
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import time
|
|
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
|
|
from autogencap.DebugLog import Info
|
|
from autogencap.ag_adapter.CAPPair import CAPPair
|
|
from autogencap.LocalActorNetwork import LocalActorNetwork
|
|
|
|
|
|
def cap_ag_pair_demo():
|
|
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
|
|
assistant = AssistantAgent("assistant", llm_config={"config_list": config_list})
|
|
user_proxy = UserProxyAgent(
|
|
"user_proxy",
|
|
code_execution_config={"work_dir": "coding"},
|
|
is_termination_msg=lambda x: "TERMINATE" in x.get("content"),
|
|
)
|
|
|
|
# Composable Agent Platform AutoGen Pair adapter
|
|
network = LocalActorNetwork()
|
|
|
|
pair = CAPPair(network, user_proxy, assistant)
|
|
pair.initiate_chat("Plot a chart of MSFT daily closing prices for last 1 Month.")
|
|
|
|
# Wait for the pair to finish
|
|
try:
|
|
while pair.running():
|
|
# Hang out for a while and print out
|
|
# status every now and then
|
|
time.sleep(0.5)
|
|
except KeyboardInterrupt:
|
|
print("Interrupted by user, shutting down.")
|
|
|
|
network.disconnect()
|
|
Info("App", "App Exit")
|