Databricks Certified Generative AI Engineer Associate Practice Questions

Databricks Certified Generative AI Engineer Associate exam preparation

Databricks Certified Generative AI Engineer Associate practice questions in English: 162 questions with explanations. The mock exam has 45 questions and 90 minutes.

Databricks Certified Generative AI Engineer Associate free question 1 / 10 · Domain 1: Design Applications

A team calls a Foundation Model APIs chat model (databricks-gpt-oss-20b) with response_format set to type json_schema, so that the model turns incoming support emails into a JSON intake ticket. Which way of writing the schema does Foundation Model APIs support?

  1. An address shape defined once and reused through $ref from both the shipping field and the billing field
  2. A contact field written with anyOf as two alternatives, one for a phone-number shape and one for an email shape
  3. A notes field whose type is written as ["string", "null"], with null returned when there is nothing to note
  4. A ZIP code field that uses pattern with a regular expression for the exact format, so the schema itself locks the shape of the value
Show the answer and explanation

Answer: C

Why this is correct
Foundation Model APIs broadly support the structured outputs that OpenAI accepts, but they accept only a subset of the JSON schema specification, because a simpler schema produces higher-quality JSON. The documentation lists the keys that are not supported: regular expressions using pattern, complex nesting or schema composition and validation using anyOf, oneOf, allOf, prefixItems or $ref, and lists of types. The list of types has one special case: a pair such as [type, "null"], where one entry is a valid JSON type and the other is "null", is allowed. Writing an optional notes field as ["string", "null"] falls under that exception.

Why the other options are wrong
"A ZIP code field that uses pattern with a regular expression for the exact format, so the schema itself locks the shape of the value" … Regular expressions using pattern are named among the keys that are not supported. Pasting a schema written for the OpenAI API straight into Foundation Model APIs would leave this field unusable, so the ZIP code format has to be checked after the response is received.
"A contact field written with anyOf as two alternatives, one for a phone-number shape and one for an email shape" … Composing schemas with anyOf, oneOf, allOf or prefixItems is documented as not supported. If one field has to carry two possible shapes, put a phone field and an email field side by side as separate fields.
"An address shape defined once and reused through $ref from both the shipping field and the billing field" … Referencing a shared definition with $ref is also on the list of unsupported keys. The shipping and billing addresses each need the same shape written out inside their own fields.

Key point
This is a common stumbling block when a schema written for the OpenAI API is brought over. Format locking with a regular expression, two alternative shapes and reusable definitions have to be handled outside the schema: check the value after it is received, or flatten the fields and write them out separately.

Go to the Databricks Certified Generative AI Engineer Associate practice app (10 free questions; purchase unlocks all questions)

See the full practice set