Skip to content

Generative AI Engineer Associate · Domain 4: Assembling and Deploying Applications · 22% of the exam

Task 4.3: Control access to resources from model serving endpoints; Identify how to serve an LLM application that leverages Foundation Model APIs; Identify batch inference workloads and apply ai_query() appropriately

Secrets-based environment variables, endpoint permissions, pay-per-token and provisioned throughput Foundation Model APIs, and batch inference over tables with ai_query.

Study it

  • Secrets, endpoint permissions and Foundation Model APIs

    Lesson coming

  • Batch inference with ai_query

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.

Question 1 · choose 2

A pyfunc chain served on Model Serving calls a third-party API whose key must not appear in code or plain-text configuration. Which TWO steps are required? (Choose TWO.)

  1. AStore the key as a plain-text environment variable
  2. BReference the key as {{secrets/scope/key}} in an environment variable
  3. CLog the key as an artifact with the model version
  4. DGive the endpoint creator READ access on the referenced secret
  5. EEnable route optimization on the endpoint
Show the answer and why
  • AStore the key as a plain-text environment variable

    Incorrect

    Plain-text variables are for values that do not need to be hidden.

  • BReference the key as {{secrets/scope/key}} in an environment variable

    Correct

    Secrets-based environment variables use this syntax; anything else is treated as plain text.

  • CLog the key as an artifact with the model version

    Incorrect

    Artifacts are stored with the model, which puts the credential in the package itself.

  • DGive the endpoint creator READ access on the referenced secret

    Correct

    The endpoint creator must have READ access to the Databricks secrets referenced in the configuration.

  • EEnable route optimization on the endpoint

    Incorrect

    Route optimization lowers latency and raises throughput; it does not handle credentials.

Model Serving fetches secrets from Databricks secret scopes at serving time and populates secrets-based environment variables for the model code.

Question 2 · choose 1

A healthcare chatbot will serve a fine-tuned variant of a supported base architecture to clinicians all day. The compliance team requires an offering with HIPAA certification, and response times must hold during traffic peaks. Which Foundation Model APIs mode fits?

  1. AStandard pay-per-token on the preconfigured endpoint
  2. BPriority pay-per-token with service_tier set to priority
  3. CAI Functions batch inference with ai_query from a job
  4. DProvisioned throughput, on demand or reserved
Show the answer and why
  • AStandard pay-per-token on the preconfigured endpoint

    Incorrect

    Standard pay-per-token serves Databricks-hosted base models on shared capacity, not the team's fine-tuned variant.

  • BPriority pay-per-token with service_tier set to priority

    Incorrect

    Priority mode keeps availability more consistent for hosted pay-per-token models, but it still does not serve a fine-tuned variant.

  • CAI Functions batch inference with ai_query from a job

    Incorrect

    AI Functions mode is recommended for batch workloads, not an interactive chatbot used all day.

  • DProvisioned throughput, on demand or reserved

    Correct

    Provisioned throughput is recommended for production, supports fine-tuned variants and performance guarantees, and is available with compliance certifications such as HIPAA.

Foundation Model APIs come in pay-per-token (with priority mode), provisioned throughput (on-demand or reserved) and AI Functions optimized modes. Provisioned throughput serves base, fine-tuned and custom-weight models of supported architectures.

Question 3 · choose 1

A nightly job summarizes 40 million rows by looping in Python over 1,000-row batches and calling a provisioned throughput endpoint. One malformed row fails the whole run, and the job overruns its window. Which redesign follows Databricks guidance for batch inference?

  1. AKeep the loop and halve the batch size so failures affect fewer rows
  2. BOne ai_query over the whole table, a batch-optimized system.ai model, failOnError => false
  3. CRun ai_query in 1,000-row slices against the same provisioned throughput endpoint, one slice per task
  4. DMove the loop to a real-time chat endpoint with scale to zero
Show the answer and why
  • AKeep the loop and halve the batch size so failures affect fewer rows

    Incorrect

    Manual splitting into small batches reduces throughput, so the overrun gets worse.

  • BOne ai_query over the whole table, a batch-optimized system.ai model, failOnError => false

    Correct

    AI Functions handle parallelization, retries and scaling across the whole dataset, batch-optimized models give the best throughput, and failOnError false keeps successful rows while recording errors.

  • CRun ai_query in 1,000-row slices against the same provisioned throughput endpoint, one slice per task

    Incorrect

    Slicing defeats the automatic parallelism, and system.ai model services are recommended over provisioned throughput endpoints for this.

  • DMove the loop to a real-time chat endpoint with scale to zero

    Incorrect

    A real-time endpoint is not built for 40 million rows, and cold starts add delay.

For batch inference, use ai_query with Databricks-hosted system.ai models optimized for batch, submit the full dataset in a single query, and set failOnError to false for large workloads.

Question 4 · choose 1

A SQL function wraps ai_query against a custom model serving endpoint. Which permission must the function's definer have on the endpoint?

  1. ACAN VIEW
  2. BSELECT on the endpoint
  3. CNo permission is needed
  4. DCAN QUERY
Show the answer and why
  • ACAN VIEW

    Incorrect

    CAN VIEW lets a user get and list the endpoint but not query it.

  • BSELECT on the endpoint

    Incorrect

    SELECT is a table privilege, not an endpoint permission.

  • CNo permission is needed

    Incorrect

    Endpoint access is permission-controlled.

  • DCAN QUERY

    Correct

    The definer of ai_query must have CAN QUERY permission on the endpoint it invokes.

ai_query invokes an existing Model Serving endpoint in the same workspace; the definer needs CAN QUERY on it. Wrapping ai_query in a function and granting EXECUTE shares it.

Question 5 · choose 1

Which commitment term does reserved provisioned throughput on Foundation Model APIs use?

  1. ANo term; release the capacity at any hour
  2. BA fixed 1- or 3-month term
  3. CA fixed 1- or 3-year term
  4. DA term per request
Show the answer and why
  • ANo term; release the capacity at any hour

    Incorrect

    That describes on-demand provisioned throughput.

  • BA fixed 1- or 3-month term

    Correct

    Reserved provisioned throughput reserves dedicated capacity for a fixed 1- or 3-month term.

  • CA fixed 1- or 3-year term

    Incorrect

    The documented terms are months, not years.

  • DA term per request

    Incorrect

    Per-request billing is pay-per-token.

Provisioned throughput comes as on-demand (no term commitment) or reserved (dedicated capacity for 1 or 3 months).

Question 6 · choose 1

An analyst passes modelParameters to ai_query with a temperature computed from a column for each row, and the query fails. What rule applies?

  1. ATemperature must be above 1.0
  2. BmodelParameters works only for embedding models, not chat models
  3. CModel parameters must be constants, not data-dependent
  4. DParameters must be set on the endpoint
Show the answer and why
  • ATemperature must be above 1.0

    Incorrect

    No such minimum applies; the default is 0.0.

  • BmodelParameters works only for embedding models, not chat models

    Incorrect

    It applies to chat, completion and embedding models.

  • CModel parameters must be constants, not data-dependent

    Correct

    ai_query model parameters must be constant and not data dependent; when omitted, temperature defaults to 0.0.

  • DParameters must be set on the endpoint

    Incorrect

    ai_query accepts modelParameters in the call itself.

modelParameters is a struct of chat, completion and embedding parameters for foundation or external models, such as max_tokens and temperature.

Question 7 · choose 1

A developer wants to call Databricks-hosted chat models from an existing Python app written against the OpenAI client. What does Databricks recommend?

  1. AKeep the OpenAI client and point it at Databricks
  2. BRewrite the app on raw JDBC calls
  3. CExport the model weights locally
  4. DUse the Databricks UI only, since the API is meant for testing
Show the answer and why
  • AKeep the OpenAI client and point it at Databricks

    Correct

    Most Foundation Model APIs are OpenAI-compatible, and Databricks recommends the OpenAI client for extended interactions.

  • BRewrite the app on raw JDBC calls

    Incorrect

    JDBC is for SQL, not model requests.

  • CExport the model weights locally

    Incorrect

    Hosted models are used through the API without exporting weights.

  • DUse the Databricks UI only, since the API is meant for testing

    Incorrect

    The UI is recommended for trying the feature, not app integration.

You can query Foundation Model APIs through the OpenAI client, the UI, the Python SDK, MLflow Deployments or REST.

Practice domain 4 →Practice all domains →