Skip to content

search

Wire-format contract for the AI Search add-on: the query a caller (a UI search box, a Mastra tool, a universal-search route) sends and the hits it gets back, plus the document shape used to add / update index contents.

Pure (zod + inferred types, no Node-only imports) so the server-side client in @dbx-tools/search, the Mastra tool, the POST /api/search route, and the React search box all validate / type against ONE definition.

“AI Search” is Databricks’ current name for Vector Search: an index built from a Delta table (or written directly) that answers a natural-language query with the most relevant rows, combining vector similarity with BM25 keyword matching (hybrid). This contract is index-agnostic - it names the index by its Unity Catalog path and returns hits as { id, score, fields } so the same shape serves an autocomplete box, a docs lookup, and a federated search across many indexes.

Array fields intentionally avoid .min() / .nonempty(): those emit minItems in the JSON schema, which some Model Serving endpoints reject when the schema is forwarded as a tool definition.