Try other clients

This commit is contained in:
Laveesh Rohra
2025-11-13 15:15:28 -08:00
Unverified
parent 15d0bda8a2
commit 3e0bc08aad
4 changed files with 14 additions and 16 deletions
@@ -8,13 +8,14 @@ Prerequisites: set `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_CHAT_DEPLOYMENT_NAM
from typing import Any
from agent_framework.azure import AgentFunctionApp, AzureOpenAIChatClient
from azure.identity import AzureCliCredential
from agent_framework.azure import AgentFunctionApp
from agent_framework.anthropic import AnthropicClient
# 1. Instantiate the agent with the chosen deployment and instructions.
def _create_agent() -> Any:
"""Create the Joker agent."""
return AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
return AnthropicClient().create_agent(
name="Joker",
instructions="You are good at telling jokes.",
)
@@ -12,6 +12,7 @@ import logging
from typing import Any
from agent_framework.azure import AgentFunctionApp, AzureOpenAIChatClient
from agent_framework.openai import OpenAIChatClient
from azure.identity import AzureCliCredential
logger = logging.getLogger(__name__)
@@ -50,15 +51,13 @@ def calculate_tip(bill_amount: float, tip_percentage: float = 15.0) -> dict[str,
# 1. Create multiple agents, each with its own instruction set and tools.
chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())
weather_agent = chat_client.create_agent(
weather_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
name="WeatherAgent",
instructions="You are a helpful weather assistant. Provide current weather information.",
tools=[get_weather],
)
math_agent = chat_client.create_agent(
math_agent = OpenAIChatClient().create_agent(
name="MathAgent",
instructions="You are a helpful math assistant. Help users with calculations like tip calculations.",
tools=[calculate_tip],
@@ -19,10 +19,9 @@ from agent_framework import AgentRunResponseUpdate
from agent_framework.azure import (
AgentCallbackContext,
AgentFunctionApp,
AgentResponseCallbackProtocol,
AzureOpenAIChatClient,
AgentResponseCallbackProtocol
)
from azure.identity import AzureCliCredential
from agent_framework.openai import OpenAIResponsesClient
logger = logging.getLogger(__name__)
@@ -110,7 +109,7 @@ class ConversationAuditTrail(AgentResponseCallbackProtocol):
# 2. Create the agent that will emit streaming updates and final responses.
callback_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
callback_agent = OpenAIResponsesClient().create_agent(
name="CallbackAgent",
instructions=(
"You are a friendly assistant that narrates actions while responding. "
@@ -16,9 +16,9 @@ from typing import Any, cast
import azure.durable_functions as df
import azure.functions as func
from agent_framework.azure import AgentFunctionApp, AzureOpenAIChatClient
from agent_framework.azure import AgentFunctionApp
from agent_framework.openai import OpenAIChatClient, OpenAIResponsesClient
from azure.durable_functions import DurableOrchestrationContext
from azure.identity import AzureCliCredential
from pydantic import BaseModel, ValidationError
logger = logging.getLogger(__name__)
@@ -43,14 +43,13 @@ class EmailPayload(BaseModel):
# 2. Instantiate both agents so they can be registered with AgentFunctionApp.
def _create_agents() -> list[Any]:
chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())
spam_agent = chat_client.create_agent(
spam_agent = OpenAIChatClient().create_agent(
name=SPAM_AGENT_NAME,
instructions="You are a spam detection assistant that identifies spam emails.",
)
email_agent = chat_client.create_agent(
email_agent = OpenAIResponsesClient().create_agent(
name=EMAIL_AGENT_NAME,
instructions="You are an email assistant that helps users draft responses to emails with professionalism.",
)