AI-102 Question 452
Select 3You are developing a solution using Azure OpenAI Service to generate Python code based on user prompts. The solution requires you to ensure that the generated code aligns with specific user requirements, such as using certain libraries and adhering to coding standards. Which of the following steps should you take to properly submit prompts and review the generated outputs?
- A
Use the 'temperature' parameter to control the randomness of the generated code.
- B
In the prompt, include detailed instructions about coding style, libraries, and expected functionality.
- C
Deploy the model to an Azure Kubernetes Service (AKS) cluster before sending prompts.
- D
Review the generated code outputs for errors and compliance with user requirements.
- E
Set the 'max_tokens' parameter to a very high value to ensure the entire code logic is generated in one request.
Show answer and explanation
Correct answers: A, B, D
Explanation
To effectively submit prompts for generating code in Azure OpenAI Service, you need to carefully control the randomness of the output using the 'temperature' parameter, provide detailed instructions in the prompt, and review the generated code for correctness and compliance with requirements. Deploying the model to AKS is unnecessary for prompt submission, and setting an excessively high 'max_tokens' value is inefficient and may lead to issues.
- A. Correct.
The 'temperature' parameter is crucial in controlling the randomness of the output. A lower value (e.g., 0.2) makes the output more deterministic, which is useful for generating structured and predictable code.
- B. Correct.
Providing detailed instructions in the prompt ensures that the AI model understands the coding style, libraries, and functionality expectations, increasing the likelihood of generating accurate and relevant code.
- C. Incorrect.
Deploying the model to AKS is unrelated to submitting prompts or generating code. It is a deployment option for hosting the model but not necessary for prompt submission.
- D. Correct.
Reviewing the generated code is a critical step to ensure it meets user requirements and doesn't contain errors or security vulnerabilities.
- E. Incorrect.
Setting the 'max_tokens' parameter to a very high value can lead to unnecessary costs and potential truncation if the token limit of the prompt and response exceeds the model's allowed maximum.