AI-102 exam dumps

AI-102 practice question 453 of 493

Designing and Implementing a Microsoft Azure AI Solution. Professional level, Microsoft. Free question with the correct answer and a full explanation.

AI-102 Question 453

Select 3

You are designing an Azure AI solution that uses Azure OpenAI Service to generate Python code snippets based on user prompts. Which steps must you include to correctly submit a prompt and retrieve a code response?

  1. A

    Authenticate using Azure Active Directory (Azure AD) or an API key for the Azure OpenAI Service.

  2. B

    Format the user prompt in JSON format and include the 'code' parameter to indicate code generation.

  3. C

    Specify the appropriate deployment name for the OpenAI model in the API request.

  4. D

    Set the response type to 'code' in the API headers to ensure only code is returned.

  5. E

    Send a POST request to the Azure OpenAI endpoint with the prompt and required parameters.

Show answer and explanation

Correct answers: A, C, E

Explanation

To generate code using Azure OpenAI Service, you must authenticate, specify the correct deployment name, and send a POST request to the endpoint with the prompt and other parameters. There is no specific 'code' parameter or header to indicate code generation; the model interprets the prompt and generates a response accordingly.

  • A. Correct.

    Authentication is mandatory to interact with Azure OpenAI Service. You must use Azure AD or an API key to securely access the service.

  • B. Incorrect.

    While the prompt is included in the API request body, there is no specific 'code' parameter for indicating code generation in the Azure OpenAI API.

  • C. Correct.

    The deployment name specifies which model deployment to use, and it is a required parameter in the API request.

  • D. Incorrect.

    There is no 'code' response type option in the API headers for Azure OpenAI Service. The response type is determined by the model and the nature of the prompt.

  • E. Correct.

    A POST request is required to send the prompt and other parameters to the Azure OpenAI Service endpoint for processing.

Timed practice exam

Take a AI-102 practice test under exam conditions

40 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam