Databricks Generative AI Engineer Associate Question 8
Single answerYou are working on a Databricks project to generate JSON-formatted responses from a generative AI model. The output must include a status field (either 'success' or 'failure'), a message field describing the result, and a data field containing relevant information. Which of the following prompts would best elicit this specifically formatted response?
- A
Generate a JSON response with any information relevant to the query.
- B
Provide a response in JSON format with fields
status,message, anddata. Ensurestatusis either 'success' or 'failure',messageexplains the result, anddatacontains relevant information. - C
Return a JSON object containing a summary of the query results.
- D
Write a response in plain text with a summary and the relevant data.
Show answer and explanation
Correct answer: B
Explanation
To elicit a specifically formatted response from a generative AI model, the prompt must clearly define the desired structure and required fields. Option 2 provides the most explicit guidance, ensuring the model generates a JSON response with the required status, message, and data fields, while the other options are either too vague or do not meet the requirements.
- A. Incorrect.
This prompt is vague and does not specify the required structure or fields. It may result in inconsistent or incomplete responses.
- B. Correct.
This prompt is explicit about the required JSON format and fields, ensuring the model generates a response that meets the specified requirements.
- C. Incorrect.
This prompt requests a JSON object but does not specify the required fields or structure, which may lead to unexpected or incomplete outputs.
- D. Incorrect.
This prompt asks for a plain text response, which does not align with the requirement for a JSON-formatted response.