@databricks/appkit 0.53.1 → 0.55.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 (103) hide show
  1. package/CLAUDE.md +9 -1
  2. package/dist/appkit/package.js +1 -1
  3. package/dist/beta.d.ts +3 -1
  4. package/dist/beta.js +2 -1
  5. package/dist/cli/commands/generate-types.js +1 -1
  6. package/dist/cli/commands/generate-types.js.map +1 -1
  7. package/dist/cli/commands/plugin/create/create.js +12 -14
  8. package/dist/cli/commands/plugin/create/create.js.map +1 -1
  9. package/dist/cli/commands/plugin/promote/promote.js +2 -12
  10. package/dist/cli/commands/plugin/promote/promote.js.map +1 -1
  11. package/dist/connectors/ai-search/client.js +145 -0
  12. package/dist/connectors/ai-search/client.js.map +1 -0
  13. package/dist/connectors/ai-search/index.js +3 -0
  14. package/dist/connectors/context.js +38 -0
  15. package/dist/connectors/context.js.map +1 -0
  16. package/dist/connectors/index.js +2 -1
  17. package/dist/connectors/serving/client.d.ts.map +1 -1
  18. package/dist/connectors/serving/client.js +2 -26
  19. package/dist/connectors/serving/client.js.map +1 -1
  20. package/dist/core/appkit.d.ts.map +1 -1
  21. package/dist/core/appkit.js.map +1 -1
  22. package/dist/naming.js +29 -0
  23. package/dist/plugin/plugin.d.ts.map +1 -1
  24. package/dist/plugin/plugin.js +2 -1
  25. package/dist/plugin/plugin.js.map +1 -1
  26. package/dist/plugins/ai-search/ai-search.d.ts +63 -0
  27. package/dist/plugins/ai-search/ai-search.d.ts.map +1 -0
  28. package/dist/plugins/ai-search/ai-search.js +296 -0
  29. package/dist/plugins/ai-search/ai-search.js.map +1 -0
  30. package/dist/plugins/ai-search/defaults.js +14 -0
  31. package/dist/plugins/ai-search/defaults.js.map +1 -0
  32. package/dist/plugins/ai-search/index.d.ts +2 -0
  33. package/dist/plugins/ai-search/index.js +3 -0
  34. package/dist/plugins/ai-search/manifest.js +73 -0
  35. package/dist/plugins/ai-search/manifest.js.map +1 -0
  36. package/dist/plugins/ai-search/types.d.ts +80 -0
  37. package/dist/plugins/ai-search/types.d.ts.map +1 -0
  38. package/dist/plugins/analytics/analytics.d.ts.map +1 -1
  39. package/dist/plugins/analytics/analytics.js +7 -1
  40. package/dist/plugins/analytics/analytics.js.map +1 -1
  41. package/dist/plugins/analytics/metric.js +1 -0
  42. package/dist/plugins/analytics/mv/index.js +1 -0
  43. package/dist/plugins/analytics/mv/metadata.js +30 -0
  44. package/dist/plugins/analytics/mv/metadata.js.map +1 -0
  45. package/dist/plugins/analytics/types.d.ts +7 -0
  46. package/dist/plugins/analytics/types.d.ts.map +1 -1
  47. package/dist/plugins/analytics/types.js.map +1 -1
  48. package/dist/plugins/beta-exports.generated.d.ts +3 -1
  49. package/dist/plugins/beta-exports.generated.js +2 -0
  50. package/dist/plugins/server/index.d.ts.map +1 -1
  51. package/dist/plugins/server/index.js +2 -1
  52. package/dist/plugins/server/index.js.map +1 -1
  53. package/dist/plugins/ui-variants/index.js.map +1 -1
  54. package/dist/plugins/ui-variants/manifest.js +1 -1
  55. package/dist/registry/resource-registry.d.ts.map +1 -1
  56. package/dist/registry/resource-registry.js +2 -7
  57. package/dist/registry/resource-registry.js.map +1 -1
  58. package/dist/schemas/manifest.d.ts.map +1 -1
  59. package/dist/schemas/manifest.js +3 -2
  60. package/dist/schemas/manifest.js.map +1 -1
  61. package/dist/shared/src/index.d.ts +1 -0
  62. package/dist/shared/src/metric-metadata.d.ts +24 -0
  63. package/dist/shared/src/metric-metadata.d.ts.map +1 -0
  64. package/dist/shared/src/naming.js +13 -0
  65. package/dist/shared/src/naming.js.map +1 -0
  66. package/dist/shared/src/plugin.d.ts +6 -4
  67. package/dist/shared/src/plugin.d.ts.map +1 -1
  68. package/dist/shared/src/schemas/manifest.d.ts +2 -2
  69. package/dist/shared/src/schemas/manifest.d.ts.map +1 -1
  70. package/dist/shared/src/sse/analytics.js +2 -1
  71. package/dist/shared/src/sse/analytics.js.map +1 -1
  72. package/dist/type-generator/errors.js +0 -3
  73. package/dist/type-generator/errors.js.map +1 -1
  74. package/dist/type-generator/index.js +15 -10
  75. package/dist/type-generator/index.js.map +1 -1
  76. package/dist/type-generator/mv-registry/render-types.js +49 -11
  77. package/dist/type-generator/mv-registry/render-types.js.map +1 -1
  78. package/dist/type-generator/query-registry.js +1 -3
  79. package/dist/type-generator/query-registry.js.map +1 -1
  80. package/dist/type-generator/vite-plugin.d.ts +4 -2
  81. package/dist/type-generator/vite-plugin.d.ts.map +1 -1
  82. package/dist/type-generator/vite-plugin.js +1 -0
  83. package/dist/type-generator/vite-plugin.js.map +1 -1
  84. package/dist/utils/banner.js +19 -0
  85. package/dist/utils/banner.js.map +1 -0
  86. package/docs/api/appkit/Interface.BasePluginConfig.md +1 -0
  87. package/docs/api/appkit/Interface.IAiSearchConfig.md +71 -0
  88. package/docs/api/appkit/Interface.IndexConfig.md +110 -0
  89. package/docs/api/appkit/Interface.RerankerConfig.md +10 -0
  90. package/docs/api/appkit/Interface.SearchRequest.md +64 -0
  91. package/docs/api/appkit/Interface.SearchResponse.md +52 -0
  92. package/docs/api/appkit/Interface.SearchResult.md +25 -0
  93. package/docs/api/appkit/TypeAlias.SearchFilters.md +6 -0
  94. package/docs/api/appkit/Variable.aiSearch.md +6 -0
  95. package/docs/api/appkit.md +8 -0
  96. package/docs/development/type-generation.md +7 -7
  97. package/docs/plugins/{vector-search.md → ai-search.md} +70 -27
  98. package/llms.txt +9 -1
  99. package/package.json +1 -1
  100. package/sbom.cdx.json +1 -1
  101. package/dist/connectors/vector-search/client.js +0 -9
  102. package/dist/connectors/vector-search/client.js.map +0 -1
  103. package/dist/connectors/vector-search/index.js +0 -3
@@ -0,0 +1,110 @@
1
+ # Interface: IndexConfig
2
+
3
+ ## Properties[​](#properties "Direct link to Properties")
4
+
5
+ ### auth?[​](#auth "Direct link to auth?")
6
+
7
+ ```ts
8
+ optional auth: "service-principal" | "on-behalf-of-user";
9
+
10
+ ```
11
+
12
+ Auth mode for the built-in HTTP routes — "service-principal" (default) uses the app's SP, "on-behalf-of-user" proxies the logged-in user's token. Programmatic callers select per call via `appkit.aiSearch.asUser(req)`.
13
+
14
+ ***
15
+
16
+ ### columns?[​](#columns "Direct link to columns?")
17
+
18
+ ```ts
19
+ optional columns: string[];
20
+
21
+ ```
22
+
23
+ Columns to return in results. Optional: in development the plugin auto-discovers them from the index's source table when omitted (and warns that they should be set explicitly for production).
24
+
25
+ ***
26
+
27
+ ### embeddingFn()?[​](#embeddingfn "Direct link to embeddingFn()?")
28
+
29
+ ```ts
30
+ optional embeddingFn: (text: string) => Promise<number[]>;
31
+
32
+ ```
33
+
34
+ For self-managed embedding indexes: converts query text to an embedding vector. When provided, the plugin calls this function and sends query\_vector to VS. When omitted, query\_text is sent and VS computes embeddings server-side (managed mode).
35
+
36
+ #### Parameters[​](#parameters "Direct link to Parameters")
37
+
38
+ | Parameter | Type |
39
+ | --------- | -------- |
40
+ | `text` | `string` |
41
+
42
+ #### Returns[​](#returns "Direct link to Returns")
43
+
44
+ `Promise`<`number`\[]>
45
+
46
+ ***
47
+
48
+ ### endpointName?[​](#endpointname "Direct link to endpointName?")
49
+
50
+ ```ts
51
+ optional endpointName: string;
52
+
53
+ ```
54
+
55
+ VS endpoint name (required when pagination is true)
56
+
57
+ ***
58
+
59
+ ### indexName?[​](#indexname "Direct link to indexName?")
60
+
61
+ ```ts
62
+ optional indexName: string;
63
+
64
+ ```
65
+
66
+ Three-level UC name: catalog.schema.index\_name. Defaults to the `DATABRICKS_VS_INDEX_NAME` env var when omitted — so multiple aliases that omit it all resolve to that same physical index. Set it explicitly per alias when they should point at distinct indexes.
67
+
68
+ ***
69
+
70
+ ### numResults?[​](#numresults "Direct link to numResults?")
71
+
72
+ ```ts
73
+ optional numResults: number;
74
+
75
+ ```
76
+
77
+ Max results per query
78
+
79
+ ***
80
+
81
+ ### pagination?[​](#pagination "Direct link to pagination?")
82
+
83
+ ```ts
84
+ optional pagination: boolean;
85
+
86
+ ```
87
+
88
+ Enable cursor pagination
89
+
90
+ ***
91
+
92
+ ### queryType?[​](#querytype "Direct link to queryType?")
93
+
94
+ ```ts
95
+ optional queryType: SearchQueryType;
96
+
97
+ ```
98
+
99
+ Default search mode
100
+
101
+ ***
102
+
103
+ ### reranker?[​](#reranker "Direct link to reranker?")
104
+
105
+ ```ts
106
+ optional reranker: boolean | RerankerConfig;
107
+
108
+ ```
109
+
110
+ Enable built-in reranker. Pass true to rerank all non-id columns, or an object for fine control.
@@ -0,0 +1,10 @@
1
+ # Interface: RerankerConfig
2
+
3
+ ## Properties[​](#properties "Direct link to Properties")
4
+
5
+ ### columnsToRerank[​](#columnstorerank "Direct link to columnsToRerank")
6
+
7
+ ```ts
8
+ columnsToRerank: string[];
9
+
10
+ ```
@@ -0,0 +1,64 @@
1
+ # Interface: SearchRequest
2
+
3
+ ## Properties[​](#properties "Direct link to Properties")
4
+
5
+ ### columns?[​](#columns "Direct link to columns?")
6
+
7
+ ```ts
8
+ optional columns: string[];
9
+
10
+ ```
11
+
12
+ ***
13
+
14
+ ### filters?[​](#filters "Direct link to filters?")
15
+
16
+ ```ts
17
+ optional filters: SearchFilters;
18
+
19
+ ```
20
+
21
+ ***
22
+
23
+ ### numResults?[​](#numresults "Direct link to numResults?")
24
+
25
+ ```ts
26
+ optional numResults: number;
27
+
28
+ ```
29
+
30
+ ***
31
+
32
+ ### queryText?[​](#querytext "Direct link to queryText?")
33
+
34
+ ```ts
35
+ optional queryText: string;
36
+
37
+ ```
38
+
39
+ ***
40
+
41
+ ### queryType?[​](#querytype "Direct link to queryType?")
42
+
43
+ ```ts
44
+ optional queryType: SearchQueryType;
45
+
46
+ ```
47
+
48
+ ***
49
+
50
+ ### queryVector?[​](#queryvector "Direct link to queryVector?")
51
+
52
+ ```ts
53
+ optional queryVector: number[];
54
+
55
+ ```
56
+
57
+ ***
58
+
59
+ ### reranker?[​](#reranker "Direct link to reranker?")
60
+
61
+ ```ts
62
+ optional reranker: boolean;
63
+
64
+ ```
@@ -0,0 +1,52 @@
1
+ # Interface: SearchResponse\<T>
2
+
3
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
4
+
5
+ | Type Parameter | Default type |
6
+ | ------------------------------------------- | ----------------------------- |
7
+ | `T` *extends* `Record`<`string`, `unknown`> | `Record`<`string`, `unknown`> |
8
+
9
+ ## Properties[​](#properties "Direct link to Properties")
10
+
11
+ ### nextPageToken[​](#nextpagetoken "Direct link to nextPageToken")
12
+
13
+ ```ts
14
+ nextPageToken: string | null;
15
+
16
+ ```
17
+
18
+ ***
19
+
20
+ ### queryTimeMs[​](#querytimems "Direct link to queryTimeMs")
21
+
22
+ ```ts
23
+ queryTimeMs: number;
24
+
25
+ ```
26
+
27
+ ***
28
+
29
+ ### queryType[​](#querytype "Direct link to queryType")
30
+
31
+ ```ts
32
+ queryType: SearchQueryType;
33
+
34
+ ```
35
+
36
+ ***
37
+
38
+ ### results[​](#results "Direct link to results")
39
+
40
+ ```ts
41
+ results: SearchResult<T>[];
42
+
43
+ ```
44
+
45
+ ***
46
+
47
+ ### totalCount[​](#totalcount "Direct link to totalCount")
48
+
49
+ ```ts
50
+ totalCount: number;
51
+
52
+ ```
@@ -0,0 +1,25 @@
1
+ # Interface: SearchResult\<T>
2
+
3
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
4
+
5
+ | Type Parameter | Default type |
6
+ | ------------------------------------------- | ----------------------------- |
7
+ | `T` *extends* `Record`<`string`, `unknown`> | `Record`<`string`, `unknown`> |
8
+
9
+ ## Properties[​](#properties "Direct link to Properties")
10
+
11
+ ### data[​](#data "Direct link to data")
12
+
13
+ ```ts
14
+ data: T;
15
+
16
+ ```
17
+
18
+ ***
19
+
20
+ ### score[​](#score "Direct link to score")
21
+
22
+ ```ts
23
+ score: number;
24
+
25
+ ```
@@ -0,0 +1,6 @@
1
+ # Type Alias: SearchFilters
2
+
3
+ ```ts
4
+ type SearchFilters = Record<string, string | number | boolean | (string | number)[]>;
5
+
6
+ ```
@@ -0,0 +1,6 @@
1
+ # Variable: aiSearch
2
+
3
+ ```ts
4
+ const aiSearch: ToPlugin<typeof AiSearchPlugin, IAiSearchConfig, "aiSearch">;
5
+
6
+ ```
@@ -50,7 +50,9 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
50
50
  | [GenerateDatabaseCredentialRequest](./docs/api/appkit/Interface.GenerateDatabaseCredentialRequest.md) | Request parameters for generating database OAuth credentials |
51
51
  | [GenerationParams](./docs/api/appkit/Interface.GenerationParams.md) | Optional generation parameters forwarded to the OpenAI-compatible serving request body. Names match the serving API wire keys. Only keys that are set are sent — undefined values are omitted so the endpoint applies its own defaults. Ranges are not validated here; the serving endpoint validates. |
52
52
  | [HostedSupervisorTool](./docs/api/appkit/Interface.HostedSupervisorTool.md) | Tagged record returned by every [supervisorTools](./docs/api/appkit/Variable.supervisorTools.md) factory. The `__kind` discriminator lets the agents plugin (and standalone `runAgent`) classify these tools without a structural match against the wire format — keeps the SA wire shape free to evolve and avoids namespace collisions with MCP hosted tools (which use `type: "genie-space"` hyphenated, vs SA's `type: "genie_space"` underscored). |
53
+ | [IAiSearchConfig](./docs/api/appkit/Interface.IAiSearchConfig.md) | Base configuration interface for AppKit plugins |
53
54
  | [IJobsConfig](./docs/api/appkit/Interface.IJobsConfig.md) | Configuration for the Jobs plugin. |
55
+ | [IndexConfig](./docs/api/appkit/Interface.IndexConfig.md) | - |
54
56
  | [ITelemetry](./docs/api/appkit/Interface.ITelemetry.md) | Plugin-facing interface for OpenTelemetry instrumentation. Provides a thin abstraction over OpenTelemetry APIs for plugins. |
55
57
  | [JobAPI](./docs/api/appkit/Interface.JobAPI.md) | User-facing API for a single configured job. |
56
58
  | [JobConfig](./docs/api/appkit/Interface.JobConfig.md) | Per-job configuration options. |
@@ -66,10 +68,14 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
66
68
  | [RegisteredAgent](./docs/api/appkit/Interface.RegisteredAgent.md) | - |
67
69
  | [RequestedClaims](./docs/api/appkit/Interface.RequestedClaims.md) | Optional claims for fine-grained Unity Catalog table permissions When specified, the returned token will be scoped to only the requested tables |
68
70
  | [RequestedResource](./docs/api/appkit/Interface.RequestedResource.md) | Resource to request permissions for in Unity Catalog |
71
+ | [RerankerConfig](./docs/api/appkit/Interface.RerankerConfig.md) | - |
69
72
  | [ResourceEntry](./docs/api/appkit/Interface.ResourceEntry.md) | Internal representation of a resource in the registry. Extends ResourceRequirement with resolution state and plugin ownership. |
70
73
  | [ResourceRequirement](./docs/api/appkit/Interface.ResourceRequirement.md) | Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). |
71
74
  | [RunAgentInput](./docs/api/appkit/Interface.RunAgentInput.md) | - |
72
75
  | [RunAgentResult](./docs/api/appkit/Interface.RunAgentResult.md) | - |
76
+ | [SearchRequest](./docs/api/appkit/Interface.SearchRequest.md) | - |
77
+ | [SearchResponse](./docs/api/appkit/Interface.SearchResponse.md) | - |
78
+ | [SearchResult](./docs/api/appkit/Interface.SearchResult.md) | - |
73
79
  | [ServingEndpointEntry](./docs/api/appkit/Interface.ServingEndpointEntry.md) | Shape of a single registry entry. |
74
80
  | [ServingEndpointRegistry](./docs/api/appkit/Interface.ServingEndpointRegistry.md) | Registry interface for serving endpoint type generation. Empty by default — augmented by the Vite type generator's `.d.ts` output via module augmentation. When populated, provides autocomplete for alias names and typed request/response/chunk per endpoint. |
75
81
  | [StreamExecutionSettings](./docs/api/appkit/Interface.StreamExecutionSettings.md) | Execution settings for streaming endpoints. Extends PluginExecutionSettings with SSE stream configuration. |
@@ -111,6 +117,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
111
117
  | [ResolvedToolEntry](./docs/api/appkit/TypeAlias.ResolvedToolEntry.md) | Internal tool-index entry after a tool record has been resolved to a dispatchable form. |
112
118
  | [ResourceFieldEntry](./docs/api/appkit/TypeAlias.ResourceFieldEntry.md) | - |
113
119
  | [ResourcePermission](./docs/api/appkit/TypeAlias.ResourcePermission.md) | Union of all possible permission levels across all resource types. |
120
+ | [SearchFilters](./docs/api/appkit/TypeAlias.SearchFilters.md) | - |
114
121
  | [ServingFactory](./docs/api/appkit/TypeAlias.ServingFactory.md) | Factory function returned by `AppKit.serving`. |
115
122
  | [SupervisorTool](./docs/api/appkit/TypeAlias.SupervisorTool.md) | Tools supported by the Databricks AI Gateway Responses API. The shapes match the wire format the endpoint expects, so the adapter passes the array straight into the request body. |
116
123
  | [ToolRegistry](./docs/api/appkit/TypeAlias.ToolRegistry.md) | - |
@@ -121,6 +128,7 @@ Documentation merge entry for Typedoc — combines the stable `@databricks/appki
121
128
  | Variable | Description |
122
129
  | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
123
130
  | [agents](./docs/api/appkit/Variable.agents.md) | Plugin factory for the agents plugin. Reads `config/agents/*.md` by default, resolves toolkits/tools from registered plugins, exposes `appkit.agents.*` runtime API and mounts `POST /invocations` and `POST /responses` (aliased non-streaming invoke endpoints) plus `POST /chat` (streaming, HITL-capable). |
131
+ | [aiSearch](./docs/api/appkit/Variable.aiSearch.md) | - |
124
132
  | [READ\_ACTIONS](./docs/api/appkit/Variable.READ_ACTIONS.md) | Actions that only read data. |
125
133
  | [sql](./docs/api/appkit/Variable.sql.md) | SQL helper namespace |
126
134
  | [SUPERVISOR\_EXTENSION\_KEY](./docs/api/appkit/Variable.SUPERVISOR_EXTENSION_KEY.md) | Namespace key under which the adapter reads its hosted-tool payload from [AgentInput.extensions](./docs/api/appkit/Interface.AgentInput.md#extensions). Exported so the agents plugin and standalone `runAgent` (the producers) can write under the same key the adapter reads. |
@@ -6,7 +6,7 @@ AppKit can automatically generate TypeScript types for your SQL queries, providi
6
6
 
7
7
  Generate type-safe TypeScript declarations for query keys, parameters, and result rows.
8
8
 
9
- All generated files live in `shared/appkit-types/`, one per concern: `analytics.d.ts` (SQL query types), `serving.d.ts` (model-serving endpoint types), and `metric-views.d.ts`. A single command (and the Vite plugin) produces them all in one pass; see [Metric-view types](#metric-view-types). The `.d.ts` files 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.
9
+ All generated files live in `shared/appkit-types/`, one per concern: `analytics.d.ts` (SQL query types), `serving.d.ts` (model-serving endpoint types), and `metric-views.ts` — a real source file rather than a `.d.ts` because it also carries a runtime `metricViewsMetadata` constant alongside the augmentation. A single command (and the Vite plugin) produces them all in one pass; see [Metric-view types](#metric-view-types). The files 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.
10
10
 
11
11
  ## Vite plugin: `appKitTypesPlugin`[​](#vite-plugin-appkittypesplugin "Direct link to vite-plugin-appkittypesplugin")
12
12
 
@@ -86,28 +86,28 @@ npx @databricks/appkit generate-types --wait
86
86
 
87
87
  #### CI resilience: committed types as fallback[​](#ci-resilience-committed-types-as-fallback "Direct link to CI resilience: committed types as fallback")
88
88
 
89
- In blocking mode (`--wait`), the generator attempts to fetch real types from your warehouse, but delegates to **committed `.d.ts` files** (`shared/appkit-types/analytics.d.ts`, `metric-views.d.ts`) as the fallback when the warehouse is unreachable. These committed files should be part of your repository. On a fresh CI checkout, every build attempts to DESCRIBE against the warehouse; the committed types are used only when that cannot complete.
89
+ In blocking mode (`--wait`), the generator attempts to fetch real types from your warehouse, but delegates to **committed type files** (`shared/appkit-types/analytics.d.ts` and, when Metric Views are configured, `shared/appkit-types/metric-views.ts`) as the fallback when the warehouse is unreachable. These generated files should be part of your repository. On a fresh CI checkout, every build attempts to DESCRIBE against the warehouse; the committed types are used only when that cannot complete.
90
90
 
91
91
  The generator **never overwrites committed types with degraded (`result: unknown`) types** — it writes real types, or it does not write at all.
92
92
 
93
93
  A **two-bucket failure taxonomy** determines whether the build crashes or falls back to committed types:
94
94
 
95
95
  * **Deterministic failures (always crash):** SQL syntax errors in your queries (genuine DESCRIBE failure against a reachable warehouse), HTTP 404 (bad or unknown warehouse ID), HTTP 400 (malformed request). These are developer or configuration errors that committed types must not hide.
96
- * **Environmental failures (gate on committed types):** Authentication failures (401/403), network unreachability, warehouse unavailability (cold, deleting, or deleted), wait timeout on `RUNNING`, or any unrecognized failure. If committed types exist, the build **keeps them, emits a loud warning to stderr, and succeeds (exit 0)**. If no committed types exist, the build **crashes** with a message instructing you to run `npx @databricks/appkit generate-types --wait` locally (against a reachable warehouse) and commit the `.d.ts` files.
96
+ * **Environmental failures (gate on committed types):** Authentication failures (401/403), network unreachability, warehouse unavailability (cold, deleting, or deleted), wait timeout on `RUNNING`, or any unrecognized failure. If every type file required by the app exists, the build **keeps them, emits a loud warning to stderr, and succeeds (exit 0)**. If a required file is missing, the build **crashes** with a message instructing you to run `npx @databricks/appkit generate-types --wait` locally (against a reachable warehouse) and commit the generated type files.
97
97
 
98
98
  The loud warning is a single greppable stderr line naming the coarse cause (auth blocked / warehouse unreachable / warehouse unavailable) and the warehouse ID, so CI logs surface that the build fell back to committed types.
99
99
 
100
- **Note:** If your app declares only metric views and no `config/queries/`, the first build still writes an empty `analytics.d.ts`, which counts as "committed types present" for the gate. An environmental failure will then fall back and warn rather than crash, even on a first build — an accepted v1 simplification.
100
+ For a Metric Views app, `metric-views.ts` must already exist before an environmental failure can fall back successfully. Unlike a declaration-only artifact, this file also exports the runtime `metricViewsMetadata` value consumed by the server, so `analytics.d.ts` alone cannot satisfy the gate.
101
101
 
102
102
  The app template wires this up for you: `postinstall` and `predev` run the non-blocking default, while `prebuild` runs `--wait`.
103
103
 
104
104
  ## Metric-view types[​](#metric-view-types "Direct link to Metric-view types")
105
105
 
106
- `generate-types` (and the Vite plugin) emit metric-view types **additively** — there is no separate command. When a `config/metric-views/definitions.json` file is present, the same run that generates your query types also DESCRIBEs each declared [UC Metric View](./docs/plugins/analytics.md) and writes `metric-views.d.ts` into `shared/appkit-types/`:
106
+ `generate-types` (and the Vite plugin) emit metric-view types **additively** — there is no separate command. When a `config/metric-views/definitions.json` file is present, the same run that generates your query types also DESCRIBEs each declared [UC Metric View](./docs/plugins/analytics.md) and writes `metric-views.ts` into `shared/appkit-types/`:
107
107
 
108
- * `metric-views.d.ts` — augments the `MetricRegistry` interface so `useMetricView('<key>', …)` is autocompleted and type-checked. Each view's measures, dimensions, and their semantic metadata (SQL type, display name, format, time grains) are encoded at the type level.
108
+ * `metric-views.ts` — augments the `MetricRegistry` interface so `useMetricView('<key>', …)` is autocompleted and type-checked. Each view's measures, dimensions, and their semantic metadata (SQL type, display name, format, time grains) are encoded at the type level. The same file also exports a runtime `metricViewsMetadata` constant carrying that metadata as a value — inject it via `analytics({ metricViewsMetadata })` so the [metric route](./docs/plugins/analytics.md#metric-views) can attach per-column display metadata to its response payload.
109
109
 
110
- If `config/metric-views/definitions.json` is absent the metric path stays dormant (nothing is emitted). When present it follows the **same** warehouse-readiness contract as query types: in the default non-blocking run a view that can't be described yet — a cold warehouse, or a bad/unreachable source — is written with permissive types and a warning, while under `--wait` metric views obey the [two-bucket taxonomy](#ci-resilience-committed-types-as-fallback) (environmental failures gate to committed `metric-views.d.ts` + warn; deterministic failures like malformed definitions crash the build). A malformed `definitions.json` (invalid JSON, or a source that isn't a three-part UC FQN) fails fast in every mode.
110
+ If `config/metric-views/definitions.json` is absent the metric path stays dormant (nothing is emitted). When present it follows the **same** warehouse-readiness contract as query types: in the default non-blocking run a view that can't be described yet — a cold warehouse, or a bad/unreachable source — is written with permissive types and a warning, while under `--wait` metric views obey the [two-bucket taxonomy](#ci-resilience-committed-types-as-fallback) (environmental failures gate to committed `metric-views.ts` + warn; deterministic failures like malformed definitions crash the build). A malformed `definitions.json` (invalid JSON, or a source that isn't a three-part UC FQN) fails fast in every mode.
111
111
 
112
112
  `definitions.json` is keyed by metric key; each entry names the three-part UC FQN of the view and, optionally, the executor it runs as (`app_service_principal`, the default, or `user`):
113
113
 
@@ -1,4 +1,8 @@
1
- # Vector Search plugin
1
+ # AI Search plugin
2
+
3
+ Beta plugin
4
+
5
+ This plugin is currently **beta**. APIs may change between minor releases. Import from `@databricks/appkit/beta`. See [Plugin Stability Tiers](./docs/plugins/stability.md).
2
6
 
3
7
  Query Databricks Vector Search indexes with hybrid search, reranking, and cursor pagination from your AppKit application.
4
8
 
@@ -14,12 +18,13 @@ Query Databricks Vector Search indexes with hybrid search, reranking, and cursor
14
18
  ## Basic usage[​](#basic-usage "Direct link to Basic usage")
15
19
 
16
20
  ```ts
17
- import { createApp, vectorSearch, server } from "@databricks/appkit";
21
+ import { createApp, server } from "@databricks/appkit";
22
+ import { aiSearch } from "@databricks/appkit/beta";
18
23
 
19
24
  await createApp({
20
25
  plugins: [
21
26
  server(),
22
- vectorSearch({
27
+ aiSearch({
23
28
  indexes: {
24
29
  products: {
25
30
  indexName: "catalog.schema.products_idx",
@@ -46,7 +51,7 @@ await createApp({
46
51
  Index aliases let you reference multiple Vector Search indexes by name. The alias is used in API routes and programmatic calls:
47
52
 
48
53
  ```ts
49
- vectorSearch({
54
+ aiSearch({
50
55
  indexes: {
51
56
  products: {
52
57
  indexName: "catalog.schema.products_idx",
@@ -62,19 +67,23 @@ vectorSearch({
62
67
 
63
68
  ```
64
69
 
70
+ note
71
+
72
+ An alias without its own `indexName` falls back to the `DATABRICKS_VS_INDEX_NAME` env var. If several aliases omit `indexName`, they all resolve to that one physical index (with their own per-alias `columns`, `queryType`, etc.). Give each alias an explicit `indexName` when you mean distinct indexes.
73
+
65
74
  ## IndexConfig[​](#indexconfig "Direct link to IndexConfig")
66
75
 
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 |
76
+ | Field | Type | Default | Description |
77
+ | -------------- | -------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
78
+ | `indexName` | `string` | `DATABRICKS_VS_INDEX_NAME` | Three-level Unity Catalog name (`catalog.schema.index`). Defaults to the `DATABRICKS_VS_INDEX_NAME` env var when omitted. |
79
+ | `columns` | `string[]` | auto-discovered in dev | Columns to return in query results. Optional in development — when omitted, the plugin reads them from the index's source table and warns. **Set explicitly for production**, where a missing value is not auto-filled. |
80
+ | `queryType` | `"ann" \| "hybrid" \| "full_text"` | `"hybrid"` | Search mode |
81
+ | `numResults` | `number` | `20` | Maximum results per query |
82
+ | `reranker` | `boolean \| { columnsToRerank: string[] }` | — | Enable reranking. Pass `true` to rerank all result columns, or specify a subset |
83
+ | `auth` | `"service-principal" \| "on-behalf-of-user"` | `"service-principal"` | Authentication mode for query execution |
84
+ | `pagination` | `boolean` | — | Enable cursor-based pagination |
85
+ | `endpointName` | `string` | — | Vector Search endpoint name. Required when `pagination` is `true` |
86
+ | `embeddingFn` | `(text: string) => Promise<number[]>` | — | Custom embedding function for self-managed embedding indexes |
78
87
 
79
88
  ### Query types[​](#query-types "Direct link to Query types")
80
89
 
@@ -87,7 +96,7 @@ vectorSearch({
87
96
  Reranking improves result relevance by running a second-stage model over the initial candidates:
88
97
 
89
98
  ```ts
90
- vectorSearch({
99
+ aiSearch({
91
100
  indexes: {
92
101
  products: {
93
102
  indexName: "catalog.schema.products_idx",
@@ -106,7 +115,7 @@ Pass `reranker: true` to rerank across all returned columns.
106
115
  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
116
 
108
117
  ```ts
109
- vectorSearch({
118
+ aiSearch({
110
119
  indexes: {
111
120
  documents: {
112
121
  indexName: "catalog.schema.documents_idx",
@@ -123,7 +132,7 @@ vectorSearch({
123
132
  Enable cursor pagination to page through large result sets:
124
133
 
125
134
  ```ts
126
- vectorSearch({
135
+ aiSearch({
127
136
  indexes: {
128
137
  products: {
129
138
  indexName: "catalog.schema.products_idx",
@@ -145,7 +154,7 @@ For indexes that manage their own embeddings, provide an `embeddingFn` that take
145
154
  ```ts
146
155
  import { embed } from "./my-embedding-client";
147
156
 
148
- vectorSearch({
157
+ aiSearch({
149
158
  indexes: {
150
159
  products: {
151
160
  indexName: "catalog.schema.products_idx",
@@ -160,7 +169,7 @@ vectorSearch({
160
169
 
161
170
  ## HTTP routes[​](#http-routes "Direct link to HTTP routes")
162
171
 
163
- Routes are mounted at `/api/vector-search`.
172
+ Routes are mounted at `/api/ai-search`.
164
173
 
165
174
  | Method | Path | Description |
166
175
  | ------ | ------------------- | ------------------------------------------------------------ |
@@ -171,7 +180,7 @@ Routes are mounted at `/api/vector-search`.
171
180
  ### Query an index[​](#query-an-index "Direct link to Query an index")
172
181
 
173
182
  ```text
174
- POST /api/vector-search/:alias/query
183
+ POST /api/ai-search/:alias/query
175
184
  Content-Type: application/json
176
185
 
177
186
  {
@@ -186,19 +195,25 @@ Response:
186
195
  ```json
187
196
  {
188
197
  "results": [
189
- { "id": "42", "name": "Intro to ML", "description": "..." }
198
+ {
199
+ "score": 0.87,
200
+ "data": { "id": "42", "name": "Intro to ML", "description": "..." }
201
+ }
190
202
  ],
203
+ "totalCount": 1,
204
+ "queryTimeMs": 35,
205
+ "queryType": "hybrid",
191
206
  "nextPageToken": "eyJvZmZzZXQiOjEwfQ=="
192
207
  }
193
208
 
194
209
  ```
195
210
 
196
- `nextPageToken` is only present when `pagination` is enabled and more results are available.
211
+ Each result carries its relevance `score` and the returned columns under `data`. `nextPageToken` is `null` unless `pagination` is enabled and more results are available.
197
212
 
198
213
  ### Fetch the next page[​](#fetch-the-next-page "Direct link to Fetch the next page")
199
214
 
200
215
  ```text
201
- POST /api/vector-search/:alias/next-page
216
+ POST /api/ai-search/:alias/next-page
202
217
  Content-Type: application/json
203
218
 
204
219
  {
@@ -211,7 +226,7 @@ Content-Type: application/json
211
226
  ### Get index config[​](#get-index-config "Direct link to Get index config")
212
227
 
213
228
  ```text
214
- GET /api/vector-search/:alias/config
229
+ GET /api/ai-search/:alias/config
215
230
 
216
231
  ```
217
232
 
@@ -222,10 +237,13 @@ Returns the resolved `IndexConfig` for the alias (excluding `embeddingFn`).
222
237
  The plugin exposes a `query` method for server-side use:
223
238
 
224
239
  ```ts
240
+ import { createApp, server } from "@databricks/appkit";
241
+ import { aiSearch } from "@databricks/appkit/beta";
242
+
225
243
  const AppKit = await createApp({
226
244
  plugins: [
227
245
  server(),
228
- vectorSearch({
246
+ aiSearch({
229
247
  indexes: {
230
248
  products: {
231
249
  indexName: "catalog.schema.products_idx",
@@ -236,7 +254,7 @@ const AppKit = await createApp({
236
254
  ],
237
255
  });
238
256
 
239
- const result = await AppKit.vectorSearch.query("products", {
257
+ const result = await AppKit.aiSearch.query("products", {
240
258
  queryText: "machine learning guide",
241
259
  });
242
260
 
@@ -245,3 +263,28 @@ console.log(result.results);
245
263
  ```
246
264
 
247
265
  Pass optional overrides as a second argument to `query` to adjust `numResults` or other per-call settings.
266
+
267
+ ## React hook[​](#react-hook "Direct link to React hook")
268
+
269
+ `useAiSearchQuery` reads the configured indexes from the plugin's client config and posts to the right `/:alias/query` route, so the UI never hardcodes an alias. With one index configured it needs no arguments; pass `{ alias }` to target a specific one.
270
+
271
+ ```tsx
272
+ import { useAiSearchQuery } from "@databricks/appkit-ui/react/beta";
273
+
274
+ function Search() {
275
+ const { search, data, loading, error } = useAiSearchQuery();
276
+
277
+ return (
278
+ <>
279
+ <input onKeyDown={(e) => e.key === "Enter" && search(e.currentTarget.value)} />
280
+ {error && <p>{error}</p>}
281
+ {data?.results.map((r, i) => (
282
+ <div key={i}>{JSON.stringify(r.data)}</div>
283
+ ))}
284
+ </>
285
+ );
286
+ }
287
+
288
+ ```
289
+
290
+ `search` also accepts a full request object (`{ queryText, numResults, filters, ... }`) for per-call control. The hook's `indexes` field lists every configured index, which you can use to build an index picker.