Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdk/ai/azure-ai-projects/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ AZURE_AI_PROJECTS_CONSOLE_LOGGING=

# Project endpoint has the format:
# `https://<your-ai-services-account-name>.services.ai.azure.com/api/projects/<your-project-name>`
AZURE_AI_PROJECT_ENDPOINT=
AZURE_AI_MODEL_DEPLOYMENT_NAME=
AZURE_AI_AGENT_NAME=
FOUNDRY_PROJECT_ENDPOINT=
FOUNDRY_MODEL_NAME=
FOUNDRY_AGENT_NAME=
CONVERSATION_ID=
CONNECTION_NAME=
MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME=
Expand Down
26 changes: 26 additions & 0 deletions sdk/ai/azure-ai-projects/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Release History

## 2.0.1b1 (Unreleased)

### Features Added

* Placeholder

### Breaking Changes

* Placeholder

### Bugs Fixed

* Placeholder

### Sample updates

* Renamed environment variable `AZURE_AI_PROJECT_ENDPOINT` to `FOUNDRY_PROJECT_ENDPOINT` in all samples.
* Renamed environment variable `AZURE_AI_MODEL_DEPLOYMENT_NAME` to `FOUNDRY_MODEL_NAME` in all samples.
* Renamed environment variable `AZURE_AI_MODEL_AGENT_NAME` to `FOUNDRY_AGENT_NAME` in all samples.
* Added CSV evaluation sample (`sample_evaluations_builtin_with_csv.py`) demonstrating evaluation with an uploaded CSV dataset.
* Added synthetic data evaluation samples (`sample_synthetic_data_agent_evaluation.py`) and (`sample_synthetic_data_model_evaluation.py`).

### Other Changes

* Placeholder

## 2.0.0 (2026-03-06)

First stable release of the client library that uses the Generally Available (GA) version "v1" of the Foundry REST APIs.
Expand Down
35 changes: 18 additions & 17 deletions sdk/ai/azure-ai-projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To report an issue with the client library, or request additional features, plea
* Python 3.9 or later.
* An [Azure subscription][azure_sub].
* A [project in Microsoft Foundry](https://learn.microsoft.com/azure/foundry/how-to/create-projects).
* A Foundry project endpoint URL of the form `https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name`. It can be found in your Microsoft Foundry Project home page. Below we will assume the environment variable `AZURE_AI_PROJECT_ENDPOINT` was defined to hold this value.
* A Foundry project endpoint URL of the form `https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name`. It can be found in your Microsoft Foundry Project home page. Below we will assume the environment variable `FOUNDRY_PROJECT_ENDPOINT` was defined to hold this value.
* An Entra ID token for authentication. Your application needs an object that implements the [TokenCredential](https://learn.microsoft.com/python/api/azure-core/azure.core.credentials.tokencredential) interface. Code samples here use [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential). To get that working, you will need:
* An appropriate role assignment. See [Role-based access control in Microsoft Foundry portal](https://learn.microsoft.com/azure/foundry/concepts/rbac-foundry). Role assignment can be done via the "Access Control (IAM)" tab of your Azure AI Project resource in the Azure portal.
* [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed.
Expand Down Expand Up @@ -87,7 +87,7 @@ from azure.identity import DefaultAzureCredential

with (
DefaultAzureCredential() as credential,
AIProjectClient(endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"], credential=credential) as project_client,
AIProjectClient(endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], credential=credential) as project_client,
):
```

Expand All @@ -107,7 +107,7 @@ from azure.identity.aio import DefaultAzureCredential

async with (
DefaultAzureCredential() as credential,
AIProjectClient(endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"], credential=credential) as project_client,
AIProjectClient(endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], credential=credential) as project_client,
):
```

Expand All @@ -117,20 +117,20 @@ async with (

Your Microsoft Foundry project may have one or more AI models deployed. These could be OpenAI models, Microsoft models, or models from other providers. Use the code below to get an authenticated [OpenAI](https://github.com/openai/openai-python?tab=readme-ov-file#usage) client from the [openai](https://pypi.org/project/openai/) package, and execute an example multi-turn "Responses" calls.

The code below assumes the environment variable `AZURE_AI_MODEL_DEPLOYMENT_NAME` is defined. It's the deployment name of an AI model in your Foundry Project. See "Build" menu, under "Models" (First column of the "Deployments" table).
The code below assumes the environment variable `FOUNDRY_MODEL_NAME` is defined. It's the deployment name of an AI model in your Foundry Project. See "Build" menu, under "Models" (First column of the "Deployments" table).

<!-- SNIPPET:sample_responses_basic.responses -->

```python
with project_client.get_openai_client() as openai_client:
response = openai_client.responses.create(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL_NAME"],
input="What is the size of France in square miles?",
)
print(f"Response output: {response.output_text}")

response = openai_client.responses.create(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL_NAME"],
input="And what is the capital city?",
previous_response_id=response.id,
)
Expand All @@ -145,7 +145,7 @@ See the "responses" folder in the [package samples][samples] for additional samp

The `.agents` property on the `AIProjectClient` gives you access to all Agent operations. Agents use an extension of the OpenAI Responses protocol, so you will need to get an `OpenAI` client to do Agent operations, as shown in the example below.

The code below assumes environment variable `AZURE_AI_MODEL_DEPLOYMENT_NAME` is defined. It's the deployment name of an AI model in your Foundry Project. See "Build" menu, under "Models" (First column of the "Deployments" table).
The code below assumes environment variable `FOUNDRY_MODEL_NAME` is defined. It's the deployment name of an AI model in your Foundry Project. See "Build" menu, under "Models" (First column of the "Deployments" table).

See the "agents" folder in the [package samples][samples] for an extensive set of samples, including streaming, tool usage and memory store usage.

Expand All @@ -156,7 +156,7 @@ with project_client.get_openai_client() as openai_client:
agent = project_client.agents.create_version(
agent_name="MyAgent",
definition=PromptAgentDefinition(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["FOUNDRY_MODEL_NAME"],
instructions="You are a helpful assistant that answers general questions",
),
)
Expand All @@ -177,7 +177,7 @@ with project_client.get_openai_client() as openai_client:
conversation_id=conversation.id,
items=[{"type": "message", "role": "user", "content": "And what is the capital city?"}],
)
print(f"Added a second user message to the conversation")
print("Added a second user message to the conversation")

response = openai_client.responses.create(
conversation=conversation.id,
Expand Down Expand Up @@ -229,7 +229,7 @@ the `code_interpreter_call` output item:

```python
code = next((output.code for output in response.output if output.type == "code_interpreter_call"), "")
print(f"Code Interpreter code:")
print("Code Interpreter code:")
print(code)
```

Expand All @@ -246,7 +246,9 @@ asset_file_path = os.path.abspath(
)

# Upload the CSV file for the code interpreter
file = openai_client.files.create(purpose="assistants", file=open(asset_file_path, "rb"))
with open(asset_file_path, "rb") as f:
file = openai_client.files.create(purpose="assistants", file=f)

tool = CodeInterpreterTool(container=AutoCodeInterpreterToolParam(file_ids=[file.id]))
```

Expand All @@ -273,9 +275,8 @@ print(f"Vector store created (id: {vector_store.id})")
asset_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../assets/product_info.md"))

# Upload file to vector store
file = openai_client.vector_stores.files.upload_and_poll(
vector_store_id=vector_store.id, file=open(asset_file_path, "rb")
)
with open(asset_file_path, "rb") as f:
file = openai_client.vector_stores.files.upload_and_poll(vector_store_id=vector_store.id, file=f)
print(f"File uploaded to vector store (id: {file.id})")

tool = FileSearchTool(vector_store_ids=[vector_store.id])
Expand Down Expand Up @@ -415,7 +416,7 @@ Call external APIs defined by OpenAPI specifications without additional client-s
<!-- SNIPPET:sample_agent_openapi.tool_declaration-->

```python
with open(weather_asset_file_path, "r") as f:
with open(weather_asset_file_path, "r", encoding="utf-8") as f:
openapi_weather = cast(dict[str, Any], jsonref.loads(f.read()))

tool = OpenApiTool(
Expand Down Expand Up @@ -765,7 +766,7 @@ with (
project_client.get_openai_client() as openai_client,
):
agent = project_client.agents.create_version(
agent_name=os.environ["AZURE_AI_AGENT_NAME"],
agent_name=os.environ["FOUNDRY_AGENT_NAME"],
definition=PromptAgentDefinition(
model=model_deployment_name,
instructions="You are a helpful assistant that answers general questions",
Expand Down Expand Up @@ -1357,7 +1358,7 @@ By default logs redact the values of URL query strings, the values of some HTTP
```python
project_client = AIProjectClient(
credential=DefaultAzureCredential(),
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
logging_enable=True
)
```
Expand Down
12 changes: 9 additions & 3 deletions sdk/ai/azure-ai-projects/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"azure.ai.projects.models.DeleteAgentResponse": "Azure.AI.Projects.DeleteAgentResponse",
"azure.ai.projects.models.DeleteAgentVersionResponse": "Azure.AI.Projects.DeleteAgentVersionResponse",
"azure.ai.projects.models.DeleteMemoryStoreResult": "Azure.AI.Projects.DeleteMemoryStoreResponse",
"azure.ai.projects.models.DeleteToolsetResponse": "Azure.AI.Projects.DeleteToolsetResponse",
"azure.ai.projects.models.Deployment": "Azure.AI.Projects.Deployment",
"azure.ai.projects.models.EmbeddingConfiguration": "Azure.AI.Projects.EmbeddingConfiguration",
"azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials",
Expand All @@ -102,6 +103,7 @@
"azure.ai.projects.models.ScheduleTask": "Azure.AI.Projects.ScheduleTask",
"azure.ai.projects.models.EvaluationScheduleTask": "Azure.AI.Projects.EvaluationScheduleTask",
"azure.ai.projects.models.EvaluationTaxonomy": "Azure.AI.Projects.EvaluationTaxonomy",
"azure.ai.projects.models.EvaluatorCredentialRequest": "Azure.AI.Projects.EvaluatorCredentialRequest",
"azure.ai.projects.models.EvaluatorMetric": "Azure.AI.Projects.EvaluatorMetric",
"azure.ai.projects.models.EvaluatorVersion": "Azure.AI.Projects.EvaluatorVersion",
"azure.ai.projects.models.FabricDataAgentToolParameters": "Azure.AI.Projects.FabricDataAgentToolParameters",
Expand Down Expand Up @@ -204,6 +206,7 @@
"azure.ai.projects.models.ToolChoiceWebSearchPreview20250311": "OpenAI.ToolChoiceWebSearchPreview20250311",
"azure.ai.projects.models.ToolDescription": "Azure.AI.Projects.ToolDescription",
"azure.ai.projects.models.ToolProjectConnection": "Azure.AI.Projects.ToolProjectConnection",
"azure.ai.projects.models.ToolsetObject": "Azure.AI.Projects.ToolsetObject",
"azure.ai.projects.models.UserProfileMemoryItem": "Azure.AI.Projects.UserProfileMemoryItem",
"azure.ai.projects.models.WebSearchApproximateLocation": "OpenAI.WebSearchApproximateLocation",
"azure.ai.projects.models.WebSearchConfiguration": "Azure.AI.Projects.WebSearchConfiguration",
Expand All @@ -212,6 +215,8 @@
"azure.ai.projects.models.WebSearchToolFilters": "OpenAI.WebSearchToolFilters",
"azure.ai.projects.models.WeeklyRecurrenceSchedule": "Azure.AI.Projects.WeeklyRecurrenceSchedule",
"azure.ai.projects.models.WorkflowAgentDefinition": "Azure.AI.Projects.WorkflowAgentDefinition",
"azure.ai.projects.models.WorkIQPreviewTool": "Azure.AI.Projects.WorkIQPreviewTool",
"azure.ai.projects.models.WorkIQPreviewToolParameters": "Azure.AI.Projects.WorkIQPreviewToolParameters",
"azure.ai.projects.models.EvaluationTaxonomyInputType": "Azure.AI.Projects.EvaluationTaxonomyInputType",
"azure.ai.projects.models.RiskCategory": "Azure.AI.Projects.RiskCategory",
"azure.ai.projects.models.FoundryFeaturesOptInKeys": "Azure.AI.Projects.FoundryFeaturesOptInKeys",
Expand All @@ -220,6 +225,7 @@
"azure.ai.projects.models.EvaluatorDefinitionType": "Azure.AI.Projects.EvaluatorDefinitionType",
"azure.ai.projects.models.EvaluatorMetricType": "Azure.AI.Projects.EvaluatorMetricType",
"azure.ai.projects.models.EvaluatorMetricDirection": "Azure.AI.Projects.EvaluatorMetricDirection",
"azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType",
"azure.ai.projects.models.OperationState": "Azure.Core.Foundations.OperationState",
"azure.ai.projects.models.InsightType": "Azure.AI.Projects.InsightType",
"azure.ai.projects.models.SampleType": "Azure.AI.Projects.SampleType",
Expand All @@ -235,8 +241,7 @@
"azure.ai.projects.models.RecurrenceType": "Azure.AI.Projects.RecurrenceType",
"azure.ai.projects.models.DayOfWeek": "Azure.AI.Projects.DayOfWeek",
"azure.ai.projects.models.ScheduleTaskType": "Azure.AI.Projects.ScheduleTaskType",
"azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType",
"azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind",
"azure.ai.projects.models.ToolsetObjectType": "Azure.AI.Projects.ToolsetObjectType",
"azure.ai.projects.models.ToolType": "OpenAI.ToolType",
"azure.ai.projects.models.AzureAISearchQueryType": "Azure.AI.Projects.AzureAISearchQueryType",
"azure.ai.projects.models.ContainerMemoryLimit": "OpenAI.ContainerMemoryLimit",
Expand All @@ -251,6 +256,8 @@
"azure.ai.projects.models.FunctionShellToolParamEnvironmentType": "OpenAI.FunctionShellToolParamEnvironmentType",
"azure.ai.projects.models.ContainerSkillType": "OpenAI.ContainerSkillType",
"azure.ai.projects.models.SearchContextSize": "OpenAI.SearchContextSize",
"azure.ai.projects.models.AgentObjectType": "Azure.AI.Projects.AgentObjectType",
"azure.ai.projects.models.AgentKind": "Azure.AI.Projects.AgentKind",
"azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol",
"azure.ai.projects.models.ToolChoiceParamType": "OpenAI.ToolChoiceParamType",
"azure.ai.projects.models.TextResponseFormatConfigurationType": "OpenAI.TextResponseFormatConfigurationType",
Expand All @@ -260,7 +267,6 @@
"azure.ai.projects.models.ConnectionType": "Azure.AI.Projects.ConnectionType",
"azure.ai.projects.models.CredentialType": "Azure.AI.Projects.CredentialType",
"azure.ai.projects.models.DatasetType": "Azure.AI.Projects.DatasetType",
"azure.ai.projects.models.PendingUploadType": "Azure.AI.Projects.PendingUploadType",
"azure.ai.projects.models.DeploymentType": "Azure.AI.Projects.DeploymentType",
"azure.ai.projects.models.IndexType": "Azure.AI.Projects.IndexType",
"azure.ai.projects.models.MemoryStoreUpdateStatus": "Azure.AI.Projects.MemoryStoreUpdateStatus",
Expand Down
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/ai/azure-ai-projects",
"Tag": "python/ai/azure-ai-projects_e907ded382"
"Tag": "python/ai/azure-ai-projects_5b25ba9450"
}
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import re
import logging
from typing import List, Any
import httpx
import httpx # pylint: disable=networking-import-outside-azure-core-transport
from openai import OpenAI
from azure.core.tracing.decorator import distributed_trace
from azure.core.credentials import TokenCredential
Expand Down
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/azure/ai/projects/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "2.0.0"
VERSION = "2.0.1b1"
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import logging
from typing import List, Any
import httpx
import httpx # pylint: disable=networking-import-outside-azure-core-transport
from openai import AsyncOpenAI
from azure.core.tracing.decorator import distributed_trace
from azure.core.credentials_async import AsyncTokenCredential
Expand Down
Loading