QuestionQ12
VerifiedImplement generative AI and agentic solutionsYou have a Python application named App1 that integrates with a Microsoft Foundry project named Project1. You need App1 to meet the following requirements:
- Authenticate by using a Microsoft Entra managed identity.
- Send prompts to a deployed model using the Azure OpenAI Responses API.
How should you complete the Python code?
Select
from azure.identity import DefaultAzureCredential from azure.ai.projects import AIProjectClient credential = () project_client = AIProjectClient( endpoint="https://contosoai.services.ai.azure.com/api/projects/project1", credential=credential, ) with project_client.get_openai_client() as openai_client: response = openai_client.responses.( model="trail-guide-chat", input="Create a 3-day hiking itinerary near Seattle.", ) print(response.output_text)
Community Discussion