mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-01 21:32:38 +00:00

* initial impl of topics and subscriptions * Update python/src/agnext/core/_agent_runtime.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * add topic in context * migrate * migrate code for topics * migrate team one * edit notebooks * formatting * fix imports * Build proto * Fix circular import --------- Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import os
|
|
|
|
from agnext.components._type_subscription import TypeSubscription
|
|
from agnext.components.models import AzureOpenAIChatCompletionClient
|
|
from agnext.core import AgentRuntime
|
|
from auditor import AuditAgent
|
|
from graphic_designer import GraphicDesignerAgent
|
|
from openai import AsyncAzureOpenAI
|
|
|
|
|
|
async def build_app(runtime: AgentRuntime) -> None:
|
|
chat_client = AzureOpenAIChatCompletionClient(
|
|
model="gpt-4-32",
|
|
azure_endpoint=os.environ["CHAT_ENDPOINT"],
|
|
api_version="2024-02-01",
|
|
model_capabilities={
|
|
"vision": True,
|
|
"function_calling": True,
|
|
"json_output": True,
|
|
},
|
|
api_key=os.environ["CHAT_ENDPOINT_KEY"],
|
|
)
|
|
|
|
image_client = AsyncAzureOpenAI(
|
|
azure_endpoint=os.environ["IMAGE_ENDPOINT"],
|
|
azure_deployment="dall-e-3",
|
|
api_key=os.environ["IMAGE_ENDPOINT_KEY"],
|
|
api_version="2024-02-01",
|
|
)
|
|
|
|
await runtime.register("GraphicDesigner", lambda: GraphicDesignerAgent(client=image_client))
|
|
await runtime.add_subscription(TypeSubscription("default", "GraphicDesigner"))
|
|
await runtime.register("Auditor", lambda: AuditAgent(model_client=chat_client))
|
|
await runtime.add_subscription(TypeSubscription("default", "Auditor"))
|