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:
co-authored by
Copilot
parent
a5eacbbe65
commit
3a49b1d6dd
@@ -27,8 +27,8 @@ The backend uses Azure OpenAI responses and supports intent-driven, non-linear h
|
||||
- Node.js 18+
|
||||
- npm 9+
|
||||
- Azure AI project + model deployment configured in environment variables:
|
||||
- `AZURE_AI_PROJECT_ENDPOINT`
|
||||
- `AZURE_AI_MODEL_DEPLOYMENT_NAME`
|
||||
- `FOUNDRY_PROJECT_ENDPOINT`
|
||||
- `FOUNDRY_MODEL`
|
||||
|
||||
## 1) Run Backend
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ def create_agents() -> tuple[Agent, Agent, Agent]:
|
||||
|
||||
client = FoundryChatClient(
|
||||
project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
|
||||
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
|
||||
model=os.environ["FOUNDRY_MODEL"],
|
||||
credential=AzureCliCredential(),
|
||||
)
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ pip install agent-framework-chatkit fastapi uvicorn azure-identity
|
||||
```bash
|
||||
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
|
||||
export AZURE_OPENAI_API_VERSION="2024-06-01"
|
||||
export AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o"
|
||||
export AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o"
|
||||
```
|
||||
|
||||
3. **Authenticate with Azure:**
|
||||
|
||||
@@ -5,4 +5,4 @@ AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
|
||||
|
||||
# Azure AI Project Configuration (for red teaming)
|
||||
# Create these resources at: https://portal.azure.com
|
||||
AZURE_AI_PROJECT_ENDPOINT=your-ai-project-name
|
||||
FOUNDRY_PROJECT_ENDPOINT=your-ai-project-name
|
||||
|
||||
@@ -11,7 +11,7 @@ For more details on the Red Team setup see [the Azure AI Foundry docs](https://l
|
||||
A focused sample demonstrating Azure AI's RedTeam functionality to assess the safety and resilience of Agent Framework agents against adversarial attacks.
|
||||
|
||||
**What it demonstrates:**
|
||||
1. Creating a financial advisor agent inline using `AzureOpenAIChatClient`
|
||||
1. Creating a financial advisor agent inline using `FoundryChatClient`
|
||||
2. Setting up an async callback to interface the agent with RedTeam evaluator
|
||||
3. Running comprehensive evaluations with 11 different attack strategies:
|
||||
- Basic: EASY and MODERATE difficulty levels
|
||||
@@ -47,7 +47,7 @@ AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
|
||||
# AZURE_OPENAI_API_KEY is optional if using Azure CLI authentication
|
||||
|
||||
# Azure AI Project (for red teaming)
|
||||
AZURE_AI_PROJECT_ENDPOINT=https://your-project.api.azureml.ms
|
||||
FOUNDRY_PROJECT_ENDPOINT=https://your-project.api.azureml.ms
|
||||
```
|
||||
|
||||
See `.env.example` for a template.
|
||||
@@ -113,7 +113,7 @@ async def main() -> None:
|
||||
credential = AzureCliCredential()
|
||||
|
||||
# 2. Create agent inline
|
||||
agent = AzureOpenAIChatClient(credential=credential).as_agent(
|
||||
agent = FoundryChatClient(credential=credential).as_agent(
|
||||
model="gpt-4o",
|
||||
instructions="You are a helpful financial advisor..."
|
||||
)
|
||||
@@ -125,7 +125,7 @@ async def main() -> None:
|
||||
|
||||
# 4. Run red team scan with multiple strategies
|
||||
red_team = RedTeam(
|
||||
azure_ai_project=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
|
||||
azure_ai_project=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
|
||||
credential=credential
|
||||
)
|
||||
results = await red_team.scan(
|
||||
|
||||
@@ -10,7 +10,7 @@ These samples demonstrate how to build and host AI agents in Python using the [A
|
||||
| [`agent_with_text_search_rag`](./agent_with_text_search_rag/) | Retrieval-augmented generation using a custom `BaseContextProvider` with Contoso Outdoors sample data |
|
||||
| [`agents_in_workflow`](./agents_in_workflow/) | Concurrent workflow that combines researcher, marketer, and legal specialist agents |
|
||||
| [`agent_with_local_tools`](./agent_with_local_tools/) | Local Python tool execution for Seattle hotel search |
|
||||
| [`writer_reviewer_agents_in_workflow`](./writer_reviewer_agents_in_workflow/) | Writer/Reviewer workflow using `AzureOpenAIResponsesClient` |
|
||||
| [`writer_reviewer_agents_in_workflow`](./writer_reviewer_agents_in_workflow/) | Writer/Reviewer workflow using `FoundryChatClient` |
|
||||
|
||||
## Common Prerequisites
|
||||
|
||||
@@ -76,14 +76,14 @@ Example `.env` for Azure OpenAI samples:
|
||||
|
||||
```dotenv
|
||||
AZURE_OPENAI_ENDPOINT=https://<your-openai-resource>.openai.azure.com/
|
||||
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=gpt-4.1
|
||||
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4.1
|
||||
```
|
||||
|
||||
Example `.env` for Foundry project samples:
|
||||
|
||||
```dotenv
|
||||
PROJECT_ENDPOINT=https://<your-resource>.services.ai.azure.com/api/projects/<your-project>
|
||||
MODEL_DEPLOYMENT_NAME=gpt-4.1
|
||||
FOUNDRY_PROJECT_ENDPOINT=https://<your-resource>.services.ai.azure.com/api/projects/<your-project>
|
||||
FOUNDRY_MODEL=gpt-4.1
|
||||
```
|
||||
|
||||
## Interacting with the Agent
|
||||
|
||||
@@ -22,7 +22,7 @@ template:
|
||||
environment_variables:
|
||||
- name: AZURE_OPENAI_ENDPOINT
|
||||
value: ${AZURE_OPENAI_ENDPOINT}
|
||||
- name: AZURE_OPENAI_CHAT_DEPLOYMENT_NAME
|
||||
- name: AZURE_OPENAI_DEPLOYMENT_NAME
|
||||
value: "{{chat}}"
|
||||
resources:
|
||||
- kind: model
|
||||
|
||||
@@ -25,7 +25,7 @@ template:
|
||||
environment_variables:
|
||||
- name: AZURE_OPENAI_ENDPOINT
|
||||
value: ${AZURE_OPENAI_ENDPOINT}
|
||||
- name: AZURE_OPENAI_CHAT_DEPLOYMENT_NAME
|
||||
- name: AZURE_OPENAI_DEPLOYMENT_NAME
|
||||
value: "{{chat}}"
|
||||
resources:
|
||||
- kind: model
|
||||
|
||||
@@ -20,7 +20,7 @@ template:
|
||||
environment_variables:
|
||||
- name: AZURE_OPENAI_ENDPOINT
|
||||
value: ${AZURE_OPENAI_ENDPOINT}
|
||||
- name: AZURE_OPENAI_CHAT_DEPLOYMENT_NAME
|
||||
- name: AZURE_OPENAI_DEPLOYMENT_NAME
|
||||
value: "{{chat}}"
|
||||
resources:
|
||||
- kind: model
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
AZURE_AI_PROJECT_ENDPOINT="<your-project-endpoint>"
|
||||
AZURE_AI_MODEL_DEPLOYMENT_NAME_WORKFLOW="<your-model-deployment>"
|
||||
AZURE_AI_MODEL_DEPLOYMENT_NAME_EVAL="<your-model-deployment>"
|
||||
FOUNDRY_PROJECT_ENDPOINT="<your-project-endpoint>"
|
||||
FOUNDRY_MODEL_WORKFLOW="<your-model-deployment>"
|
||||
FOUNDRY_MODEL_EVAL="<your-model-deployment>"
|
||||
|
||||
@@ -99,7 +99,7 @@ def fetch_agent_responses(openai_client: OpenAI, workflow_data: dict[str, Any],
|
||||
|
||||
def create_evaluation(openai_client: OpenAI, deployment_name: str | None = "gpt-5.2") -> EvalCreateResponse:
|
||||
"""Create evaluation with multiple evaluators."""
|
||||
deployment_name = os.environ.get("AZURE_AI_MODEL_DEPLOYMENT_NAME", deployment_name)
|
||||
deployment_name = os.environ.get("FOUNDRY_MODEL", deployment_name)
|
||||
data_source_config = {"type": "azure_ai_source", "scenario": "responses"}
|
||||
|
||||
testing_criteria = [
|
||||
@@ -199,8 +199,8 @@ async def main():
|
||||
openai_client = create_openai_client()
|
||||
|
||||
# Model configuration
|
||||
workflow_agent_model = os.environ.get("AZURE_AI_MODEL_DEPLOYMENT_NAME_WORKFLOW", "gpt-4.1-nano")
|
||||
eval_model = os.environ.get("AZURE_AI_MODEL_DEPLOYMENT_NAME_EVAL", "gpt-5.2")
|
||||
workflow_agent_model = os.environ.get("FOUNDRY_MODEL_WORKFLOW", "gpt-4.1-nano")
|
||||
eval_model = os.environ.get("FOUNDRY_MODEL_EVAL", "gpt-5.2")
|
||||
|
||||
# Focus on these agents, uncomment other ones you want to have evals run on
|
||||
agents_to_evaluate = [
|
||||
|
||||
Reference in New Issue
Block a user