From fdb8ed4c0c1f203118f9f84de0ec3634f104ec93 Mon Sep 17 00:00:00 2001 From: aifanatic Date: Tue, 3 Nov 2026 23:33:03 -0600 Subject: [PATCH] Python: Point multimodal and declarative MCP samples at FOUNDRY_* settings Co-Authored-By: Claude Opus 5.5 --- .../samples/02-agents/declarative/mcp_tool_yaml.py | 4 ++-- python/samples/02-agents/multimodal_input/README.md | 13 ++++--------- .../multimodal_input/azure_chat_multimodal.py | 2 +- .../multimodal_input/azure_responses_multimodal.py | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/python/samples/02-agents/declarative/mcp_tool_yaml.py b/python/samples/02-agents/declarative/mcp_tool_yaml.py index 5a71add97ab..d7728b689ae 100644 --- a/python/samples/02-agents/declarative/mcp_tool_yaml.py +++ b/python/samples/02-agents/declarative/mcp_tool_yaml.py @@ -127,7 +127,7 @@ async def run_azure_ai_example(): Prerequisites: 1. Create a Foundry connection named 'github-mcp-oauth-connection' in your Azure AI project with OAuth credentials for GitHub - 2. Set PROJECT_ENDPOINT environment variable to your Azure AI project endpoint + 2. Set the FOUNDRY_PROJECT_ENDPOINT environment variable to your Foundry project endpoint """ print("=" * 60) print("Example 2: Azure AI with Foundry Connection Reference") @@ -154,7 +154,7 @@ async def main(): await run_openai_example() # Run the Azure AI example (uncomment to run) - # Requires: Foundry connection set up and PROJECT_ENDPOINT env var + # Requires: Foundry connection set up and FOUNDRY_PROJECT_ENDPOINT env var # await run_azure_ai_example() diff --git a/python/samples/02-agents/multimodal_input/README.md b/python/samples/02-agents/multimodal_input/README.md index a96df45fddb..11d84e2957d 100644 --- a/python/samples/02-agents/multimodal_input/README.md +++ b/python/samples/02-agents/multimodal_input/README.md @@ -29,15 +29,10 @@ Set the following environment variables before running the examples: **For OpenAI:** - `OPENAI_API_KEY`: Your OpenAI API key -**For Azure OpenAI:** +**For the Azure examples (`FoundryChatClient`):** -- `AZURE_OPENAI_ENDPOINT`: Your Azure OpenAI endpoint -- `AZURE_OPENAI_MODEL`: The name of your Azure OpenAI chat model deployment -- `AZURE_OPENAI_MODEL`: The name of your Azure OpenAI responses model deployment - -Optionally for Azure OpenAI: -- `AZURE_OPENAI_API_VERSION`: The API version to use (default is `2024-10-21`) -- `AZURE_OPENAI_API_KEY`: Your Azure OpenAI API key (if not using `AzureCliCredential`) +- `FOUNDRY_PROJECT_ENDPOINT`: Your Microsoft Foundry project endpoint, for example `https://your-account.services.ai.azure.com/api/projects/your-project` +- `FOUNDRY_MODEL`: The name of your model deployment **Note:** You can also provide configuration directly in code instead of using environment variables: ```python @@ -51,7 +46,7 @@ client = FoundryChatClient( ## Authentication -The Azure example uses `AzureCliCredential` for authentication. Run `az login` in your terminal before running the example, or replace `AzureCliCredential` with your preferred authentication method (e.g., provide `api_key` parameter). +The Azure examples use `AzureCliCredential` for authentication. Run `az login` in your terminal before running them, or replace `AzureCliCredential` with another Azure Identity credential. ## Running the Examples diff --git a/python/samples/02-agents/multimodal_input/azure_chat_multimodal.py b/python/samples/02-agents/multimodal_input/azure_chat_multimodal.py index 2d7c5c9a208..8d4b0ebf0a2 100644 --- a/python/samples/02-agents/multimodal_input/azure_chat_multimodal.py +++ b/python/samples/02-agents/multimodal_input/azure_chat_multimodal.py @@ -21,7 +21,7 @@ def create_sample_image() -> str: async def test_image() -> None: """Test image analysis with Azure OpenAI.""" # For authentication, run `az login` command in terminal or replace AzureCliCredential with preferred - # authentication option. Requires AZURE_OPENAI_ENDPOINT and FOUNDRY_MODEL + # authentication option. Requires FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL # environment variables to be set. # Alternatively, you can pass model explicitly: # client = FoundryChatClient(credential=AzureCliCredential(), model="your-deployment-name") diff --git a/python/samples/02-agents/multimodal_input/azure_responses_multimodal.py b/python/samples/02-agents/multimodal_input/azure_responses_multimodal.py index ec0a684c47d..97a4cf6a6ad 100644 --- a/python/samples/02-agents/multimodal_input/azure_responses_multimodal.py +++ b/python/samples/02-agents/multimodal_input/azure_responses_multimodal.py @@ -30,7 +30,7 @@ def create_sample_image() -> str: async def test_image() -> None: """Test image analysis with Azure OpenAI Responses API.""" # For authentication, run `az login` command in terminal or replace AzureCliCredential with preferred - # authentication option. Requires AZURE_OPENAI_ENDPOINT and FOUNDRY_MODEL + # authentication option. Requires FOUNDRY_PROJECT_ENDPOINT and FOUNDRY_MODEL # environment variables to be set. # Alternatively, you can pass model explicitly: # client = FoundryChatClient(credential=AzureCliCredential(), model="your-deployment-name")