Hussein Mozannar c8f6f3bb38 Fix TeamOne examples with subscriptions to topics (#407)
* logprobs openai support

* remove print statement

* Update _types.py

* Update _openai_client.py

* empty commit to run checks

* fix teamone examples subscription

* update sample usage

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
2024-08-27 15:03:21 -04:00

35 lines
1.1 KiB
Python

import os
from agnext.components import DefaultSubscription
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), lambda: [DefaultSubscription()]
)
await runtime.register("Auditor", lambda: AuditAgent(model_client=chat_client), lambda: [DefaultSubscription()])