Databricks - Gen AI Engineer Associate Study Guide

    4: Assembling and Deploying Applications

    This chapter assembles the design decisions from Chapters 1-3 into a shippable Databricks generative AI application. It walks through coding pyfunc chains with pre- and post-processing, locking down service principal access from serving endpoints, building simple chains backed by persistent datastores, picking RAG building blocks against a model signature, registering models to Unity Catalog through MLflow, creating and querying Mosaic AI Vector Search indexes, serving against Foundation Model APIs, and explaining the internal components of Vector Search itself.

    Learning Objectives

    By the end of this chapter, you will be able to:

    • Code a chain using a pyfunc model with pre- and post-processing
    • Control access to resources from model serving endpoints
    • Code a simple chain according to requirements
    • Choose the basic elements needed to create a RAG application: model flavor, embedding model, retriever, dependencies, input examples, model signature
    • Register the model to Unity Catalog using MLflow
    • Create and query a Vector Search index
    • Identify how to serve an LLM application that leverages Foundation Model APIs
    • Explain the key concepts and components of Mosaic AI Vector Search

    Executive Summary

    • The mlflow.pyfunc flavor is the deployment-time wrapper for any chain that needs custom pre-processing, post-processing, or non-standard dependencies; mlflow.langchain and mlflow.openai are thin specializations of the same loader contract.
    • Resource access from a serving endpoint is governed by DatabricksResource declarations baked into the logged model, an automatically minted service principal token (M2M OAuth), and Unity Catalog grants on the Vector Search index, function, and table referenced by the chain.
    • Mosaic AI Vector Search is split into a compute layer (the vector search endpoint) and a storage layer (the index); the index can be Delta Sync (managed, source-of-truth Delta table) or Direct Access (you write vectors yourself), and queries return columns from the source table plus a distance score.
    • Foundation Model APIs ship in two shapes: pay-per-token for shared multi-tenant use and provisioned throughput for capacity-reserved single-tenant use; the Agent Framework adds review apps, Lakebase memory, and Databricks Apps as deployment surfaces.

    Assumptions

    • All identifiers in this chapter use the three-level Unity Catalog naming convention catalog.schema.object. The placeholder catalog is main and the placeholder schema is genai_prod unless otherwise noted.
    • The cluster runtime is Databricks Runtime 15.4 LTS for ML or later, which ships with mlflow, databricks-vectorsearch, databricks-agents, and the LangChain integrations preinstalled.
    • All code is provided in SQL where data manipulation is in scope, and in Python (PySpark or Pandas) otherwise, matching the published exam style.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account
    6. Free with account
    7. Free with account
    8. Free with account
    9. Free with account