@databricks/appkit 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CLAUDE.md +1 -0
  2. package/dist/appkit/package.js +1 -1
  3. package/dist/cache/index.js.map +1 -1
  4. package/dist/cli/commands/docs.js +7 -1
  5. package/dist/cli/commands/docs.js.map +1 -1
  6. package/dist/cli/commands/generate-types.js +20 -10
  7. package/dist/cli/commands/generate-types.js.map +1 -1
  8. package/dist/cli/commands/lint.js +3 -1
  9. package/dist/cli/commands/lint.js.map +1 -1
  10. package/dist/cli/commands/plugin/add-resource/add-resource.js +73 -8
  11. package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -1
  12. package/dist/cli/commands/plugin/create/create.js +164 -20
  13. package/dist/cli/commands/plugin/create/create.js.map +1 -1
  14. package/dist/cli/commands/plugin/create/resource-defaults.js +5 -1
  15. package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -1
  16. package/dist/cli/commands/plugin/index.js +7 -1
  17. package/dist/cli/commands/plugin/index.js.map +1 -1
  18. package/dist/cli/commands/plugin/list/list.js +7 -1
  19. package/dist/cli/commands/plugin/list/list.js.map +1 -1
  20. package/dist/cli/commands/plugin/sync/sync.js +27 -14
  21. package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
  22. package/dist/cli/commands/plugin/validate/validate.js +39 -9
  23. package/dist/cli/commands/plugin/validate/validate.js.map +1 -1
  24. package/dist/cli/commands/setup.js +6 -5
  25. package/dist/cli/commands/setup.js.map +1 -1
  26. package/dist/connectors/index.js +1 -0
  27. package/dist/connectors/lakebase/index.js.map +1 -1
  28. package/dist/connectors/lakebase-v1/client.js.map +1 -1
  29. package/dist/connectors/vector-search/client.js +9 -0
  30. package/dist/connectors/vector-search/client.js.map +1 -0
  31. package/dist/connectors/vector-search/index.js +3 -0
  32. package/dist/plugin/dev-reader.js.map +1 -1
  33. package/dist/plugins/server/vite-dev-server.js.map +1 -1
  34. package/dist/plugins/serving/serving.d.ts.map +1 -1
  35. package/dist/plugins/serving/serving.js +22 -8
  36. package/dist/plugins/serving/serving.js.map +1 -1
  37. package/dist/plugins/serving/types.d.ts +11 -10
  38. package/dist/plugins/serving/types.d.ts.map +1 -1
  39. package/dist/type-generator/index.js +13 -1
  40. package/dist/type-generator/index.js.map +1 -1
  41. package/dist/type-generator/migration.js +155 -0
  42. package/dist/type-generator/migration.js.map +1 -0
  43. package/dist/type-generator/serving/generator.js +22 -1
  44. package/dist/type-generator/serving/generator.js.map +1 -1
  45. package/dist/type-generator/serving/vite-plugin.d.ts +1 -1
  46. package/dist/type-generator/serving/vite-plugin.js +2 -2
  47. package/dist/type-generator/serving/vite-plugin.js.map +1 -1
  48. package/dist/type-generator/vite-plugin.d.ts.map +1 -1
  49. package/dist/type-generator/vite-plugin.js +3 -4
  50. package/dist/type-generator/vite-plugin.js.map +1 -1
  51. package/docs/api/appkit/TypeAlias.ServingFactory.md +9 -5
  52. package/docs/development/type-generation.md +6 -5
  53. package/docs/plugins/analytics.md +1 -1
  54. package/docs/plugins/custom-plugins.md +4 -0
  55. package/docs/plugins/plugin-management.md +22 -6
  56. package/docs/plugins/vector-search.md +247 -0
  57. package/llms.txt +1 -0
  58. package/package.json +1 -1
  59. package/sbom.cdx.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.js","names":[],"sources":["../../src/type-generator/vite-plugin.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\nimport { createLogger } from \"../logging/logger\";\nimport { generateFromEntryPoint } from \"./index\";\n\nconst logger = createLogger(\"type-generator:vite-plugin\");\n\n/**\n * Options for the AppKit types plugin.\n */\ninterface AppKitTypesPluginOptions {\n /* Path to the output d.ts file (relative to client folder). */\n outFile?: string;\n /** Folders to watch for changes. */\n watchFolders?: string[];\n}\n\n/**\n * Vite plugin to generate types for AppKit queries.\n * Calls generateFromEntryPoint under the hood.\n * @param options - Options to override default values.\n * @returns Vite plugin to generate types for AppKit queries.\n */\nexport function appKitTypesPlugin(options?: AppKitTypesPluginOptions): Plugin {\n let root: string;\n let outFile: string;\n let watchFolders: string[];\n\n async function generate() {\n try {\n const warehouseId = process.env.DATABRICKS_WAREHOUSE_ID || \"\";\n\n if (!warehouseId) {\n logger.debug(\"Warehouse ID not found. Skipping type generation.\");\n return;\n }\n\n await generateFromEntryPoint({\n outFile,\n queryFolder: watchFolders[0],\n warehouseId,\n noCache: false,\n });\n } catch (error) {\n // throw in production to fail the build\n if (process.env.NODE_ENV === \"production\") {\n throw error;\n }\n logger.error(\"Error generating types: %O\", error);\n }\n }\n\n return {\n name: \"appkit-types\",\n\n apply() {\n const warehouseId = process.env.DATABRICKS_WAREHOUSE_ID || \"\";\n\n if (!warehouseId) {\n logger.debug(\"Warehouse ID not found. Skipping type generation.\");\n return false;\n }\n\n if (!existsSync(path.join(process.cwd(), \"config\", \"queries\"))) {\n return false;\n }\n\n return true;\n },\n\n configResolved(config) {\n root = config.root;\n outFile = path.resolve(root, options?.outFile ?? \"src/appKitTypes.d.ts\");\n watchFolders = options?.watchFolders ?? [\n path.join(process.cwd(), \"config\", \"queries\"),\n ];\n },\n\n buildStart() {\n generate();\n },\n\n configureServer(server) {\n server.watcher.add(watchFolders);\n\n server.watcher.on(\"change\", (changedFile) => {\n const isWatchedFile = watchFolders.some((folder) =>\n changedFile.startsWith(folder),\n );\n\n if (isWatchedFile && changedFile.endsWith(\".sql\")) {\n generate();\n }\n });\n },\n };\n}\n"],"mappings":";;;;;;AAMA,MAAM,SAAS,aAAa,6BAA6B;;;;;;;AAkBzD,SAAgB,kBAAkB,SAA4C;CAC5E,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,eAAe,WAAW;AACxB,MAAI;GACF,MAAM,cAAc,QAAQ,IAAI,2BAA2B;AAE3D,OAAI,CAAC,aAAa;AAChB,WAAO,MAAM,oDAAoD;AACjE;;AAGF,SAAM,uBAAuB;IAC3B;IACA,aAAa,aAAa;IAC1B;IACA,SAAS;IACV,CAAC;WACK,OAAO;AAEd,OAAI,QAAQ,IAAI,aAAa,aAC3B,OAAM;AAER,UAAO,MAAM,8BAA8B,MAAM;;;AAIrD,QAAO;EACL,MAAM;EAEN,QAAQ;AAGN,OAAI,EAFgB,QAAQ,IAAI,2BAA2B,KAEzC;AAChB,WAAO,MAAM,oDAAoD;AACjE,WAAO;;AAGT,OAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,KAAK,EAAE,UAAU,UAAU,CAAC,CAC5D,QAAO;AAGT,UAAO;;EAGT,eAAe,QAAQ;AACrB,UAAO,OAAO;AACd,aAAU,KAAK,QAAQ,MAAM,SAAS,WAAW,uBAAuB;AACxE,kBAAe,SAAS,gBAAgB,CACtC,KAAK,KAAK,QAAQ,KAAK,EAAE,UAAU,UAAU,CAC9C;;EAGH,aAAa;AACX,aAAU;;EAGZ,gBAAgB,QAAQ;AACtB,UAAO,QAAQ,IAAI,aAAa;AAEhC,UAAO,QAAQ,GAAG,WAAW,gBAAgB;AAK3C,QAJsB,aAAa,MAAM,WACvC,YAAY,WAAW,OAAO,CAC/B,IAEoB,YAAY,SAAS,OAAO,CAC/C,WAAU;KAEZ;;EAEL"}
1
+ {"version":3,"file":"vite-plugin.js","names":[],"sources":["../../src/type-generator/vite-plugin.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { Plugin } from \"vite\";\nimport { createLogger } from \"../logging/logger\";\nimport {\n ANALYTICS_TYPES_FILE,\n generateFromEntryPoint,\n TYPES_DIR,\n} from \"./index\";\n\nconst logger = createLogger(\"type-generator:vite-plugin\");\n\n/**\n * Options for the AppKit types plugin.\n */\ninterface AppKitTypesPluginOptions {\n /* Path to the output d.ts file (relative to client folder). */\n outFile?: string;\n /** Folders to watch for changes. */\n watchFolders?: string[];\n}\n\n/**\n * Vite plugin to generate types for AppKit queries.\n * Calls generateFromEntryPoint under the hood.\n * @param options - Options to override default values.\n * @returns Vite plugin to generate types for AppKit queries.\n */\nexport function appKitTypesPlugin(options?: AppKitTypesPluginOptions): Plugin {\n let outFile: string;\n let watchFolders: string[];\n\n async function generate() {\n try {\n const warehouseId = process.env.DATABRICKS_WAREHOUSE_ID || \"\";\n\n if (!warehouseId) {\n logger.debug(\"Warehouse ID not found. Skipping type generation.\");\n return;\n }\n\n await generateFromEntryPoint({\n outFile,\n queryFolder: watchFolders[0],\n warehouseId,\n noCache: false,\n });\n } catch (error) {\n // throw in production to fail the build\n if (process.env.NODE_ENV === \"production\") {\n throw error;\n }\n logger.error(\"Error generating types: %O\", error);\n }\n }\n\n return {\n name: \"appkit-types\",\n\n apply() {\n const warehouseId = process.env.DATABRICKS_WAREHOUSE_ID || \"\";\n\n if (!warehouseId) {\n logger.debug(\"Warehouse ID not found. Skipping type generation.\");\n return false;\n }\n\n if (!existsSync(path.join(process.cwd(), \"config\", \"queries\"))) {\n return false;\n }\n\n return true;\n },\n\n configResolved(config) {\n const projectRoot = path.resolve(config.root, \"..\");\n outFile = path.resolve(\n projectRoot,\n options?.outFile ?? `shared/${TYPES_DIR}/${ANALYTICS_TYPES_FILE}`,\n );\n watchFolders = options?.watchFolders ?? [\n path.join(process.cwd(), \"config\", \"queries\"),\n ];\n },\n\n buildStart() {\n generate();\n },\n\n configureServer(server) {\n server.watcher.add(watchFolders);\n\n server.watcher.on(\"change\", (changedFile) => {\n const isWatchedFile = watchFolders.some((folder) =>\n changedFile.startsWith(folder),\n );\n\n if (isWatchedFile && changedFile.endsWith(\".sql\")) {\n generate();\n }\n });\n },\n };\n}\n"],"mappings":";;;;;;AAUA,MAAM,SAAS,aAAa,6BAA6B;;;;;;;AAkBzD,SAAgB,kBAAkB,SAA4C;CAC5E,IAAI;CACJ,IAAI;CAEJ,eAAe,WAAW;AACxB,MAAI;GACF,MAAM,cAAc,QAAQ,IAAI,2BAA2B;AAE3D,OAAI,CAAC,aAAa;AAChB,WAAO,MAAM,oDAAoD;AACjE;;AAGF,SAAM,uBAAuB;IAC3B;IACA,aAAa,aAAa;IAC1B;IACA,SAAS;IACV,CAAC;WACK,OAAO;AAEd,OAAI,QAAQ,IAAI,aAAa,aAC3B,OAAM;AAER,UAAO,MAAM,8BAA8B,MAAM;;;AAIrD,QAAO;EACL,MAAM;EAEN,QAAQ;AAGN,OAAI,EAFgB,QAAQ,IAAI,2BAA2B,KAEzC;AAChB,WAAO,MAAM,oDAAoD;AACjE,WAAO;;AAGT,OAAI,CAAC,WAAW,KAAK,KAAK,QAAQ,KAAK,EAAE,UAAU,UAAU,CAAC,CAC5D,QAAO;AAGT,UAAO;;EAGT,eAAe,QAAQ;GACrB,MAAM,cAAc,KAAK,QAAQ,OAAO,MAAM,KAAK;AACnD,aAAU,KAAK,QACb,aACA,SAAS,WAAW,UAAU,UAAU,GAAG,uBAC5C;AACD,kBAAe,SAAS,gBAAgB,CACtC,KAAK,KAAK,QAAQ,KAAK,EAAE,UAAU,UAAU,CAC9C;;EAGH,aAAa;AACX,aAAU;;EAGZ,gBAAgB,QAAQ;AACtB,UAAO,QAAQ,IAAI,aAAa;AAEhC,UAAO,QAAQ,GAAG,WAAW,gBAAgB;AAK3C,QAJsB,aAAa,MAAM,WACvC,YAAY,WAAW,OAAO,CAC/B,IAEoB,YAAY,SAAS,OAAO,CAC/C,WAAU;KAEZ;;EAEL"}
@@ -1,15 +1,19 @@
1
1
  # Type Alias: ServingFactory
2
2
 
3
3
  ```ts
4
- type ServingFactory = keyof ServingEndpointRegistry extends never ? (alias?: string) => ServingEndpointHandle : <K>(alias: K) => ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]>;
4
+ type ServingFactory = keyof ServingEndpointRegistry extends never ? (alias?: string) => ServingEndpointHandle : true extends IsUnion<keyof ServingEndpointRegistry> ? <K>(alias: K) => ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]> : {
5
+ <K> (alias: K): ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]>;
6
+ (): ServingEndpointHandle<never, never>;
7
+ };
5
8
 
6
9
  ```
7
10
 
8
11
  Factory function returned by `AppKit.serving`.
9
12
 
10
- This is a conditional type that adapts based on whether `ServingEndpointRegistry` has been populated via module augmentation (generated by `appKitServingTypesPlugin()`):
13
+ Adapts based on the `ServingEndpointRegistry` state:
11
14
 
12
- * **Registry empty (default):** `(alias?: string) => ServingEndpointHandle` — accepts any alias string with untyped request/response.
13
- * **Registry populated:** `<K>(alias: K) => ServingEndpointHandle<...>` restricts `alias` to known endpoint keys and infers typed request/response from the registry entry.
15
+ * **Empty (default):** `(alias?: string) => ServingEndpointHandle` — any string, untyped.
16
+ * **Single key:** alias optional — `serving()` returns the typed handle for the only endpoint.
17
+ * **Multiple keys:** alias required — must specify which endpoint.
14
18
 
15
- Run `appKitServingTypesPlugin()` in your Vite config to generate the registry augmentation and enable full type safety.
19
+ Run `npx appkit generate-types` or start the dev server to generate the registry.
@@ -4,7 +4,9 @@ AppKit can automatically generate TypeScript types for your SQL queries, providi
4
4
 
5
5
  ## Goal[​](#goal "Direct link to Goal")
6
6
 
7
- Generate `client/src/appKitTypes.d.ts` so query keys, parameters, and result rows are type-safe.
7
+ Generate type-safe TypeScript declarations for query keys, parameters, and result rows.
8
+
9
+ All generated files live in `shared/appkit-types/`, one per plugin (e.g. `analytics.d.ts`). They use [`declare module`](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) to augment existing interfaces, so the types apply globally — you never need to import them. TypeScript auto-discovers them through `"include": ["shared/appkit-types"]` in your tsconfig.
8
10
 
9
11
  ## Vite plugin: `appKitTypesPlugin`[​](#vite-plugin-appkittypesplugin "Direct link to vite-plugin-appkittypesplugin")
10
12
 
@@ -12,7 +14,7 @@ The recommended approach is to use the Vite plugin, which watches your SQL files
12
14
 
13
15
  ### Configuration[​](#configuration "Direct link to Configuration")
14
16
 
15
- * `outFile?: string` - Output file path (default: `src/appKitTypes.d.ts`)
17
+ * `outFile?: string` - Output file path (default: `shared/appkit-types/analytics.d.ts`)
16
18
  * `watchFolders?: string[]` - Folders to watch for SQL files (default: `["../config/queries"]`)
17
19
 
18
20
  ### Example[​](#example "Direct link to Example")
@@ -27,7 +29,6 @@ export default defineConfig({
27
29
  plugins: [
28
30
  react(),
29
31
  appKitTypesPlugin({
30
- outFile: "src/appKitTypes.d.ts",
31
32
  watchFolders: ["../config/queries"],
32
33
  }),
33
34
  ],
@@ -54,14 +55,14 @@ npx @databricks/appkit generate-types [rootDir] [outFile] [warehouseId]
54
55
  * Generate types using warehouse ID from environment
55
56
 
56
57
  ```bash
57
- npx @databricks/appkit generate-types . client/src/appKitTypes.d.ts
58
+ npx @databricks/appkit generate-types . shared/appkit-types/analytics.d.ts
58
59
 
59
60
  ```
60
61
 
61
62
  * Generate types using warehouse ID explicitly
62
63
 
63
64
  ```bash
64
- npx @databricks/appkit generate-types . client/src/appKitTypes.d.ts abc123...
65
+ npx @databricks/appkit generate-types . shared/appkit-types/analytics.d.ts abc123...
65
66
 
66
67
  ```
67
68
 
@@ -139,7 +139,7 @@ function SpendTable() {
139
139
  Augment the `QueryRegistry` interface to get full type inference on parameters and results:
140
140
 
141
141
  ```ts
142
- // config/appKitTypes.d.ts
142
+ // shared/appkit-types/analytics.d.ts
143
143
  declare module "@databricks/appkit-ui/react" {
144
144
  interface QueryRegistry {
145
145
  spend_summary: {
@@ -3,8 +3,12 @@
3
3
  If you need custom API routes or background logic, implement an AppKit plugin. The fastest way is to use the CLI:
4
4
 
5
5
  ```bash
6
+ # Interactive
6
7
  npx @databricks/appkit plugin create
7
8
 
9
+ # Non-interactive
10
+ npx @databricks/appkit plugin create --placement in-repo --path plugins/my-plugin --name my-plugin --description "My plugin" --force
11
+
8
12
  ```
9
13
 
10
14
  For a deeper understanding of the plugin structure, read on.
@@ -6,19 +6,30 @@ AppKit includes a CLI for managing plugins. All commands are available under `np
6
6
 
7
7
  ## Create a plugin[​](#create-a-plugin "Direct link to Create a plugin")
8
8
 
9
- Scaffold a new plugin interactively:
9
+ Scaffold a new plugin interactively or via flags:
10
10
 
11
11
  ```bash
12
+ # Interactive mode (prompts for all options)
12
13
  npx @databricks/appkit plugin create
13
14
 
15
+ # Non-interactive mode (all required flags provided)
16
+ npx @databricks/appkit plugin create \
17
+ --placement in-repo \
18
+ --path plugins/my-plugin \
19
+ --name my-plugin \
20
+ --description "My custom plugin" \
21
+ --resources sql_warehouse \
22
+ --force
23
+
14
24
  ```
15
25
 
16
- The wizard walks you through:
26
+ In interactive mode, the wizard walks you through:
17
27
 
18
28
  * **Placement**: In your repository (e.g. `plugins/my-plugin`) or as a standalone package
19
29
  * **Metadata**: Name, display name, description
20
30
  * **Resources**: Which Databricks resources the plugin needs (SQL Warehouse, Secret, etc.) and whether each is required or optional
21
- * **Optional fields**: Author, version, license
31
+
32
+ In non-interactive mode, `--placement`, `--path`, `--name`, and `--description` are required. Resources can be specified as a comma-separated list (`--resources sql_warehouse,volume`) or as JSON for full control (`--resources-json '[{"type":"sql_warehouse","permission":"CAN_MANAGE"}]'`). For all available options, run `npx @databricks/appkit plugin create --help`.
22
33
 
23
34
  The command generates a complete plugin scaffold with `manifest.json` and a TypeScript plugin class that imports the manifest directly — ready to register in your app.
24
35
 
@@ -91,12 +102,17 @@ npx @databricks/appkit plugin list --json
91
102
 
92
103
  ## Add a resource to a plugin[​](#add-a-resource-to-a-plugin "Direct link to Add a resource to a plugin")
93
104
 
94
- Interactively add a new resource requirement to an existing plugin manifest. **Requires `manifest.json`** in the plugin directory (the command edits it in place; it does not modify `manifest.js`):
105
+ Add a new resource requirement to an existing plugin manifest. **Requires `manifest.json`** in the plugin directory (the command edits it in place; it does not modify `manifest.js`):
95
106
 
96
107
  ```bash
108
+ # Interactive mode
97
109
  npx @databricks/appkit plugin add-resource
98
-
99
- # Or specify the plugin directory
100
110
  npx @databricks/appkit plugin add-resource --path plugins/my-plugin
101
111
 
112
+ # Non-interactive mode (--type triggers flag-based mode)
113
+ npx @databricks/appkit plugin add-resource --path plugins/my-plugin --type sql_warehouse
114
+ npx @databricks/appkit plugin add-resource --path plugins/my-plugin --type volume --no-required --dry-run
115
+
102
116
  ```
117
+
118
+ In non-interactive mode, only `--type` is required — all other fields (permission, resource key, field env vars) default to sensible values from the schema. Use `--dry-run` to preview the updated manifest without writing. For all available options, run `npx @databricks/appkit plugin add-resource --help`.
@@ -0,0 +1,247 @@
1
+ # Vector Search plugin
2
+
3
+ Query Databricks Vector Search indexes with hybrid search, reranking, and cursor pagination from your AppKit application.
4
+
5
+ **Key features:**
6
+
7
+ * Named index aliases for multiple Vector Search indexes
8
+ * Hybrid, ANN, and full-text query modes
9
+ * Optional reranking with column-level control
10
+ * Cursor-based pagination for large result sets
11
+ * Service principal (default) and on-behalf-of-user auth
12
+ * Self-managed embedding indexes via custom `embeddingFn`
13
+
14
+ ## Basic usage[​](#basic-usage "Direct link to Basic usage")
15
+
16
+ ```ts
17
+ import { createApp, vectorSearch, server } from "@databricks/appkit";
18
+
19
+ await createApp({
20
+ plugins: [
21
+ server(),
22
+ vectorSearch({
23
+ indexes: {
24
+ products: {
25
+ indexName: "catalog.schema.products_idx",
26
+ columns: ["id", "name", "description"],
27
+ queryType: "hybrid",
28
+ numResults: 20,
29
+ },
30
+ },
31
+ }),
32
+ ],
33
+ });
34
+
35
+ ```
36
+
37
+ ## Configuration options[​](#configuration-options "Direct link to Configuration options")
38
+
39
+ | Option | Type | Default | Description |
40
+ | --------- | ----------------------------- | ------- | -------------------------------------------------------- |
41
+ | `indexes` | `Record<string, IndexConfig>` | — | **Required.** Map of alias names to index configurations |
42
+ | `timeout` | `number` | `30000` | Query timeout in ms |
43
+
44
+ ### Index aliases[​](#index-aliases "Direct link to Index aliases")
45
+
46
+ Index aliases let you reference multiple Vector Search indexes by name. The alias is used in API routes and programmatic calls:
47
+
48
+ ```ts
49
+ vectorSearch({
50
+ indexes: {
51
+ products: {
52
+ indexName: "catalog.schema.products_idx",
53
+ columns: ["id", "name", "description"],
54
+ },
55
+ docs: {
56
+ indexName: "catalog.schema.docs_idx",
57
+ columns: ["id", "title", "content", "url"],
58
+ queryType: "full_text",
59
+ },
60
+ },
61
+ });
62
+
63
+ ```
64
+
65
+ ## IndexConfig[​](#indexconfig "Direct link to IndexConfig")
66
+
67
+ | Field | Type | Default | Description |
68
+ | -------------- | -------------------------------------------- | --------------------- | ------------------------------------------------------------------------------- |
69
+ | `indexName` | `string` | — | **Required.** Three-level Unity Catalog name (`catalog.schema.index`) |
70
+ | `columns` | `string[]` | — | **Required.** Columns to return in query results |
71
+ | `queryType` | `"ann" \| "hybrid" \| "full_text"` | `"hybrid"` | Search mode |
72
+ | `numResults` | `number` | `20` | Maximum results per query |
73
+ | `reranker` | `boolean \| { columnsToRerank: string[] }` | — | Enable reranking. Pass `true` to rerank all result columns, or specify a subset |
74
+ | `auth` | `"service-principal" \| "on-behalf-of-user"` | `"service-principal"` | Authentication mode for query execution |
75
+ | `pagination` | `boolean` | — | Enable cursor-based pagination |
76
+ | `endpointName` | `string` | — | Vector Search endpoint name. Required when `pagination` is `true` |
77
+ | `embeddingFn` | `(text: string) => Promise<number[]>` | — | Custom embedding function for self-managed embedding indexes |
78
+
79
+ ### Query types[​](#query-types "Direct link to Query types")
80
+
81
+ * **`hybrid`** — Combines vector similarity and keyword search. Best for general-purpose retrieval.
82
+ * **`ann`** — Approximate nearest neighbor search using embeddings only. Best for semantic similarity.
83
+ * **`full_text`** — Keyword-based search with no embedding required.
84
+
85
+ ### Reranking[​](#reranking "Direct link to Reranking")
86
+
87
+ Reranking improves result relevance by running a second-stage model over the initial candidates:
88
+
89
+ ```ts
90
+ vectorSearch({
91
+ indexes: {
92
+ products: {
93
+ indexName: "catalog.schema.products_idx",
94
+ columns: ["id", "name", "description", "category"],
95
+ reranker: { columnsToRerank: ["name", "description"] },
96
+ },
97
+ },
98
+ });
99
+
100
+ ```
101
+
102
+ Pass `reranker: true` to rerank across all returned columns.
103
+
104
+ ### On-behalf-of-user auth[​](#on-behalf-of-user-auth "Direct link to On-behalf-of-user auth")
105
+
106
+ By default, queries run as the app's service principal. Set `auth: "on-behalf-of-user"` to execute queries as the signed-in user instead:
107
+
108
+ ```ts
109
+ vectorSearch({
110
+ indexes: {
111
+ documents: {
112
+ indexName: "catalog.schema.documents_idx",
113
+ columns: ["id", "title", "body"],
114
+ auth: "on-behalf-of-user",
115
+ },
116
+ },
117
+ });
118
+
119
+ ```
120
+
121
+ ### Pagination[​](#pagination "Direct link to Pagination")
122
+
123
+ Enable cursor pagination to page through large result sets:
124
+
125
+ ```ts
126
+ vectorSearch({
127
+ indexes: {
128
+ products: {
129
+ indexName: "catalog.schema.products_idx",
130
+ columns: ["id", "name", "description"],
131
+ pagination: true,
132
+ endpointName: "my-vector-search-endpoint",
133
+ },
134
+ },
135
+ });
136
+
137
+ ```
138
+
139
+ `endpointName` is required when `pagination` is `true`. Use the `/:alias/next-page` route to fetch subsequent pages.
140
+
141
+ ### Self-managed embedding indexes[​](#self-managed-embedding-indexes "Direct link to Self-managed embedding indexes")
142
+
143
+ For indexes that manage their own embeddings, provide an `embeddingFn` that takes a query string and returns a vector:
144
+
145
+ ```ts
146
+ import { embed } from "./my-embedding-client";
147
+
148
+ vectorSearch({
149
+ indexes: {
150
+ products: {
151
+ indexName: "catalog.schema.products_idx",
152
+ columns: ["id", "name", "description"],
153
+ queryType: "ann",
154
+ embeddingFn: (text) => embed(text),
155
+ },
156
+ },
157
+ });
158
+
159
+ ```
160
+
161
+ ## HTTP routes[​](#http-routes "Direct link to HTTP routes")
162
+
163
+ Routes are mounted at `/api/vector-search`.
164
+
165
+ | Method | Path | Description |
166
+ | ------ | ------------------- | ------------------------------------------------------------ |
167
+ | `POST` | `/:alias/query` | Query an index by alias |
168
+ | `POST` | `/:alias/next-page` | Fetch the next page of results (requires `pagination: true`) |
169
+ | `GET` | `/:alias/config` | Return the resolved config for an index alias |
170
+
171
+ ### Query an index[​](#query-an-index "Direct link to Query an index")
172
+
173
+ ```text
174
+ POST /api/vector-search/:alias/query
175
+ Content-Type: application/json
176
+
177
+ {
178
+ "queryText": "machine learning guide",
179
+ "numResults": 10
180
+ }
181
+
182
+ ```
183
+
184
+ Response:
185
+
186
+ ```json
187
+ {
188
+ "results": [
189
+ { "id": "42", "name": "Intro to ML", "description": "..." }
190
+ ],
191
+ "nextPageToken": "eyJvZmZzZXQiOjEwfQ=="
192
+ }
193
+
194
+ ```
195
+
196
+ `nextPageToken` is only present when `pagination` is enabled and more results are available.
197
+
198
+ ### Fetch the next page[​](#fetch-the-next-page "Direct link to Fetch the next page")
199
+
200
+ ```text
201
+ POST /api/vector-search/:alias/next-page
202
+ Content-Type: application/json
203
+
204
+ {
205
+ "queryText": "machine learning guide",
206
+ "pageToken": "eyJvZmZzZXQiOjEwfQ=="
207
+ }
208
+
209
+ ```
210
+
211
+ ### Get index config[​](#get-index-config "Direct link to Get index config")
212
+
213
+ ```text
214
+ GET /api/vector-search/:alias/config
215
+
216
+ ```
217
+
218
+ Returns the resolved `IndexConfig` for the alias (excluding `embeddingFn`).
219
+
220
+ ## Programmatic access[​](#programmatic-access "Direct link to Programmatic access")
221
+
222
+ The plugin exposes a `query` method for server-side use:
223
+
224
+ ```ts
225
+ const AppKit = await createApp({
226
+ plugins: [
227
+ server(),
228
+ vectorSearch({
229
+ indexes: {
230
+ products: {
231
+ indexName: "catalog.schema.products_idx",
232
+ columns: ["id", "name", "description"],
233
+ },
234
+ },
235
+ }),
236
+ ],
237
+ });
238
+
239
+ const result = await AppKit.vectorSearch.query("products", {
240
+ queryText: "machine learning guide",
241
+ });
242
+
243
+ console.log(result.results);
244
+
245
+ ```
246
+
247
+ Pass optional overrides as a second argument to `query` to adjust `numResults` or other per-call settings.
package/llms.txt CHANGED
@@ -52,6 +52,7 @@ npx @databricks/appkit docs <query>
52
52
  - [Plugin management](./docs/plugins/plugin-management.md): AppKit includes a CLI for managing plugins. All commands are available under npx @databricks/appkit plugin.
53
53
  - [Server plugin](./docs/plugins/server.md): Provides HTTP server capabilities with development and production modes.
54
54
  - [Serving plugin](./docs/plugins/serving.md): Provides an authenticated proxy to Databricks Model Serving endpoints, with invoke and streaming support.
55
+ - [Vector Search plugin](./docs/plugins/vector-search.md): Query Databricks Vector Search indexes with hybrid search, reranking, and cursor pagination from your AppKit application.
55
56
 
56
57
  ## appkit API reference [collapsed]
57
58
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@databricks/appkit",
3
3
  "type": "module",
4
- "version": "0.23.0",
4
+ "version": "0.24.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "packageManager": "pnpm@10.21.0",