mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Remove deprecated Python OpenAI/Azure AI surfaces (#4990)
* [BREAKING] Remove deprecated Python OpenAI/Azure AI surfaces Also clean up follow-on docs, environment guidance, package metadata, and lab test stability. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix deleted semantic-kernel sample links Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * improve foundry language * Fix A2A Foundry sample regression Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
a5eacbbe65
commit
3a49b1d6dd
@@ -71,7 +71,7 @@ class GAIATelemetryConfig:
|
||||
|
||||
Note:
|
||||
For Azure Monitor integration, configure using environment variables
|
||||
(OTEL_EXPORTER_OTLP_ENDPOINT, etc.) or use AzureAIClient.configure_azure_monitor()
|
||||
(OTEL_EXPORTER_OTLP_ENDPOINT, etc.) or call ``configure_azure_monitor()``
|
||||
before creating the GAIA instance.
|
||||
"""
|
||||
self.enable_tracing = enable_tracing
|
||||
|
||||
@@ -6,8 +6,8 @@ This module provides a factory function to create an Azure AI agent
|
||||
configured for GAIA benchmark tasks.
|
||||
|
||||
Required Environment Variables:
|
||||
AZURE_AI_PROJECT_ENDPOINT: Azure AI project endpoint URL
|
||||
AZURE_AI_MODEL_DEPLOYMENT_NAME: Name of the model deployment to use
|
||||
FOUNDRY_PROJECT_ENDPOINT: Azure AI project endpoint URL
|
||||
FOUNDRY_MODEL: Name of the model deployment to use
|
||||
|
||||
Optional Environment Variables:
|
||||
BING_CONNECTION_ID: ID of the Bing connection for web search
|
||||
@@ -17,17 +17,18 @@ Authentication:
|
||||
Run `az login` before executing to authenticate.
|
||||
|
||||
Example:
|
||||
export AZURE_AI_PROJECT_ENDPOINT="https://your-project.azure.com"
|
||||
export AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o"
|
||||
export FOUNDRY_PROJECT_ENDPOINT="https://your-project.azure.com"
|
||||
export FOUNDRY_MODEL="gpt-4o"
|
||||
export BING_CONNECTION_ID="connection-id"
|
||||
az login
|
||||
"""
|
||||
|
||||
import os
|
||||
from collections.abc import AsyncIterator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from agent_framework import Agent
|
||||
from agent_framework.azure import AzureAIAgentClient
|
||||
from agent_framework.foundry import FoundryChatClient
|
||||
from azure.identity.aio import AzureCliCredential
|
||||
|
||||
|
||||
@@ -49,13 +50,17 @@ async def create_gaia_agent() -> AsyncIterator[Agent]:
|
||||
"""
|
||||
async with (
|
||||
AzureCliCredential() as credential,
|
||||
AzureAIAgentClient(credential=credential).as_agent(
|
||||
FoundryChatClient(
|
||||
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
|
||||
model=os.environ["FOUNDRY_MODEL"],
|
||||
credential=credential,
|
||||
).as_agent(
|
||||
name="GaiaAgent",
|
||||
instructions="Solve tasks to your best ability. Use Bing Search to find "
|
||||
"information and Code Interpreter to perform calculations and data analysis.",
|
||||
tools=[
|
||||
AzureAIAgentClient.get_web_search_tool(),
|
||||
AzureAIAgentClient.get_code_interpreter_tool(),
|
||||
FoundryChatClient.get_web_search_tool(),
|
||||
FoundryChatClient.get_code_interpreter_tool(),
|
||||
],
|
||||
) as agent,
|
||||
):
|
||||
|
||||
@@ -26,7 +26,7 @@ from collections.abc import AsyncIterator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from agent_framework import Agent
|
||||
from agent_framework.openai import OpenAIResponsesClient
|
||||
from agent_framework.openai import OpenAIChatClient
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -47,15 +47,15 @@ async def create_gaia_agent() -> AsyncIterator[Agent]:
|
||||
result = await agent.run("What is the capital of France?")
|
||||
print(result.text)
|
||||
"""
|
||||
client = OpenAIResponsesClient()
|
||||
client = OpenAIChatClient()
|
||||
|
||||
async with client.as_agent(
|
||||
name="GaiaAgent",
|
||||
instructions="Solve tasks to your best ability. Use Web Search to find "
|
||||
"information and Code Interpreter to perform calculations and data analysis.",
|
||||
tools=[
|
||||
OpenAIResponsesClient.get_web_search_tool(),
|
||||
OpenAIResponsesClient.get_code_interpreter_tool(),
|
||||
OpenAIChatClient.get_web_search_tool(),
|
||||
OpenAIChatClient.get_code_interpreter_tool(),
|
||||
],
|
||||
) as agent:
|
||||
yield agent
|
||||
|
||||
Reference in New Issue
Block a user