Databricks Generative AI Engineer Associate Question 12
Single answerYou are designing a prompt for a large language model (LLM) to generate a JSON object containing information about a user's profile, including their name, age, and location. The response should always be in the following JSON format: { "name": "<name>", "age": <age>, "location": "<location>" }. Which of the following prompts is most likely to elicit the desired response format?
- A
Provide the user's profile information as a JSON object containing 'name', 'age', and 'location'.
- B
Generate a JSON object with the following structure:
{ "name": "<name>", "age": <age>, "location": "<location>" }. Replace the placeholders with realistic values. - C
Write a paragraph describing a user's profile, including their name, age, and location.
- D
Create a list of details about a user, including their name, age, and location.
Show answer and explanation
Correct answer: B
Explanation
To elicit a specifically formatted response from an LLM, the prompt should clearly define the desired structure and provide an example of the format. Including explicit instructions to replace placeholders ensures that the model generates the output in the correct format. Option 2 satisfies all these criteria, making it the best choice for this scenario.
- A. Incorrect.
This prompt asks for JSON information but does not explicitly specify the desired structure or instruct the model to follow a specific format.
- B. Correct.
This prompt explicitly defines the desired JSON structure, provides an example, and instructs the model to replace placeholders with realistic values, making it the most effective choice.
- C. Incorrect.
This prompt asks for a paragraph, which is not the desired JSON format.
- D. Incorrect.
This prompt suggests creating a list, which does not meet the requirement of generating a JSON object in the specified format.