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.pyfuncflavor is the deployment-time wrapper for any chain that needs custom pre-processing, post-processing, or non-standard dependencies;mlflow.langchainandmlflow.openaiare thin specializations of the same loader contract. - Resource access from a serving endpoint is governed by
DatabricksResourcedeclarations 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 ismainand the placeholder schema isgenai_produnless 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.
