azure foundry - creating project and chatting with an agent or model
To use Azure Foundry, first we need to ceate a project. It is important to note the project endpoint after you created it. Next, you will need to deploy a model. We also need to install the required packages pip install azure-ai-projects>=2.0.0 The key environment variable to set are :- PROJECT_ENDPOINT=<endpoint copied from welcome screen> AGENT_NAME="MyAgent" Chatting with a model To chat with an Azure Foundry model we can use the following from azure . identity import DefaultAzureCredential from azure . ai . projects import AIProjectClient # Format: "https://resource_name.ai.azure.com/api/projects/project_name" PROJECT_ENDPOINT = " your_project_endpoint " # Create project and openai clients to call Foundry API project = AIProjectClient ( endpoint=PROJECT_ENDPOINT , credential=DefaultAzureCredential (), ) openai = project . get_openai_client () # Run a responses API call response = openai . responses . create ( ...