@databricks/appkit-ui 0.12.2 → 0.13.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.
- package/CLAUDE.md +1 -0
- package/dist/react/charts/area/index.d.ts +2 -2
- package/dist/react/charts/bar/index.d.ts +2 -2
- package/dist/react/charts/base.d.ts +2 -2
- package/dist/react/charts/base.d.ts.map +1 -1
- package/dist/react/charts/create-chart.d.ts +2 -2
- package/dist/react/charts/create-chart.d.ts.map +1 -1
- package/dist/react/charts/heatmap/index.d.ts +2 -2
- package/dist/react/charts/line/index.d.ts +2 -2
- package/dist/react/charts/options.d.ts.map +1 -1
- package/dist/react/charts/pie/index.d.ts +3 -3
- package/dist/react/charts/radar/index.d.ts +2 -2
- package/dist/react/charts/scatter/index.d.ts +2 -2
- package/dist/react/charts/wrapper.d.ts +2 -2
- package/dist/react/table/data-table.d.ts +2 -2
- package/dist/react/table/data-table.d.ts.map +1 -1
- package/dist/react/ui/accordion.d.ts +5 -5
- package/dist/react/ui/alert-dialog.d.ts +12 -12
- package/dist/react/ui/alert.d.ts +4 -4
- package/dist/react/ui/aspect-ratio.d.ts +2 -2
- package/dist/react/ui/avatar.d.ts +4 -4
- package/dist/react/ui/badge.d.ts +2 -2
- package/dist/react/ui/breadcrumb.d.ts +8 -8
- package/dist/react/ui/button-group.d.ts +4 -4
- package/dist/react/ui/button.d.ts +2 -2
- package/dist/react/ui/calendar.d.ts +3 -3
- package/dist/react/ui/card.d.ts +8 -8
- package/dist/react/ui/carousel.d.ts +6 -6
- package/dist/react/ui/chart.d.ts +19 -19
- package/dist/react/ui/chart.d.ts.map +1 -1
- package/dist/react/ui/checkbox.d.ts +2 -2
- package/dist/react/ui/collapsible.d.ts +4 -4
- package/dist/react/ui/command.d.ts +10 -10
- package/dist/react/ui/context-menu.d.ts +16 -16
- package/dist/react/ui/dialog.d.ts +11 -11
- package/dist/react/ui/drawer.d.ts +11 -11
- package/dist/react/ui/dropdown-menu.d.ts +16 -16
- package/dist/react/ui/empty.d.ts +7 -7
- package/dist/react/ui/field.d.ts +11 -11
- package/dist/react/ui/form.d.ts +9 -9
- package/dist/react/ui/form.d.ts.map +1 -1
- package/dist/react/ui/hover-card.d.ts +4 -4
- package/dist/react/ui/input-group.d.ts +7 -7
- package/dist/react/ui/input-otp.d.ts +5 -5
- package/dist/react/ui/input.d.ts +2 -2
- package/dist/react/ui/item.d.ts +11 -11
- package/dist/react/ui/kbd.d.ts +3 -3
- package/dist/react/ui/label.d.ts +2 -2
- package/dist/react/ui/menubar.d.ts +17 -17
- package/dist/react/ui/navigation-menu.d.ts +9 -9
- package/dist/react/ui/pagination.d.ts +8 -8
- package/dist/react/ui/popover.d.ts +5 -5
- package/dist/react/ui/progress.d.ts +2 -2
- package/dist/react/ui/radio-group.d.ts +3 -3
- package/dist/react/ui/resizable.d.ts +4 -4
- package/dist/react/ui/scroll-area.d.ts +3 -3
- package/dist/react/ui/select.d.ts +11 -11
- package/dist/react/ui/separator.d.ts +2 -2
- package/dist/react/ui/sheet.d.ts +9 -9
- package/dist/react/ui/sidebar.d.ts +24 -24
- package/dist/react/ui/skeleton.d.ts +2 -2
- package/dist/react/ui/slider.d.ts +2 -2
- package/dist/react/ui/sonner.d.ts +2 -2
- package/dist/react/ui/spinner.d.ts +2 -2
- package/dist/react/ui/switch.d.ts +2 -2
- package/dist/react/ui/table.d.ts +9 -9
- package/dist/react/ui/tabs.d.ts +5 -5
- package/dist/react/ui/textarea.d.ts +2 -2
- package/dist/react/ui/toggle-group.d.ts +3 -3
- package/dist/react/ui/toggle.d.ts +2 -2
- package/dist/react/ui/tooltip.d.ts +5 -5
- package/dist/react/ui/tooltip.d.ts.map +1 -1
- package/docs/plugins/genie.md +162 -0
- package/docs/plugins.md +2 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Genie plugin
|
|
2
|
+
|
|
3
|
+
Integrates [Databricks AI/BI Genie](https://docs.databricks.com/en/genie/index.html) spaces into your AppKit application, enabling natural language data queries via a conversational interface.
|
|
4
|
+
|
|
5
|
+
**Key features:**
|
|
6
|
+
|
|
7
|
+
* Named space aliases for multiple Genie spaces
|
|
8
|
+
* SSE streaming with real-time status updates
|
|
9
|
+
* Conversation history replay with automatic reconnection
|
|
10
|
+
* Query result attachment fetching
|
|
11
|
+
* On-behalf-of (OBO) user execution
|
|
12
|
+
|
|
13
|
+
## Basic usage[](#basic-usage "Direct link to Basic usage")
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createApp, genie, server } from "@databricks/appkit";
|
|
17
|
+
|
|
18
|
+
await createApp({
|
|
19
|
+
plugins: [
|
|
20
|
+
server(),
|
|
21
|
+
genie(),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration options[](#configuration-options "Direct link to Configuration options")
|
|
28
|
+
|
|
29
|
+
| Option | Type | Default | Description |
|
|
30
|
+
| --------- | ------------------------ | ---------------------------------------- | ------------------------------------------------ |
|
|
31
|
+
| `spaces` | `Record<string, string>` | `{ default: DATABRICKS_GENIE_SPACE_ID }` | Map of alias names to Genie Space IDs |
|
|
32
|
+
| `timeout` | `number` | `120000` | Polling timeout in ms. Set to `0` for indefinite |
|
|
33
|
+
|
|
34
|
+
### Space aliases[](#space-aliases "Direct link to Space aliases")
|
|
35
|
+
|
|
36
|
+
Space aliases let you reference multiple Genie spaces by name. The alias is used in API routes and the frontend `<GenieChat>` component:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
genie({
|
|
40
|
+
spaces: {
|
|
41
|
+
sales: "01ABCDEF12345678",
|
|
42
|
+
support: "01GHIJKL87654321",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If you omit `spaces`, the plugin reads `DATABRICKS_GENIE_SPACE_ID` from the environment and registers it under the `default` alias.
|
|
49
|
+
|
|
50
|
+
## Environment variables[](#environment-variables "Direct link to Environment variables")
|
|
51
|
+
|
|
52
|
+
| Variable | Description |
|
|
53
|
+
| --------------------------- | ------------------------------------------------------------- |
|
|
54
|
+
| `DATABRICKS_GENIE_SPACE_ID` | Default Genie Space ID (used when `spaces` config is omitted) |
|
|
55
|
+
|
|
56
|
+
## HTTP endpoints[](#http-endpoints "Direct link to HTTP endpoints")
|
|
57
|
+
|
|
58
|
+
The genie plugin exposes these endpoints (mounted under `/api/genie`):
|
|
59
|
+
|
|
60
|
+
* `POST /api/genie/:alias/messages` — Send a message to a Genie space (SSE stream)
|
|
61
|
+
* `GET /api/genie/:alias/conversations/:conversationId` — Replay conversation history (SSE stream)
|
|
62
|
+
|
|
63
|
+
### Send a message[](#send-a-message "Direct link to Send a message")
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
POST /api/genie/:alias/messages
|
|
67
|
+
Content-Type: application/json
|
|
68
|
+
|
|
69
|
+
{
|
|
70
|
+
"content": "What were total sales last quarter?",
|
|
71
|
+
"conversationId": "optional-existing-conversation-id"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The response is an SSE stream that emits these event types:
|
|
77
|
+
|
|
78
|
+
| Event type | Description |
|
|
79
|
+
| ---------------- | --------------------------------------------------------------- |
|
|
80
|
+
| `message_start` | Conversation and message IDs assigned |
|
|
81
|
+
| `status` | Processing status updates (e.g. `ASKING_AI`, `EXECUTING_QUERY`) |
|
|
82
|
+
| `message_result` | Final message with text and query attachments |
|
|
83
|
+
| `query_result` | Tabular data for a query attachment |
|
|
84
|
+
| `error` | Error details |
|
|
85
|
+
|
|
86
|
+
### Get conversation history[](#get-conversation-history "Direct link to Get conversation history")
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
GET /api/genie/:alias/conversations/:conversationId
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Returns an SSE stream of `message_result` and `query_result` events for all messages in the conversation.
|
|
94
|
+
|
|
95
|
+
## Programmatic access[](#programmatic-access "Direct link to Programmatic access")
|
|
96
|
+
|
|
97
|
+
The plugin exports `sendMessage` and `getConversation` for server-side use:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const AppKit = await createApp({
|
|
101
|
+
plugins: [server(), genie({ spaces: { demo: "space-id" } })],
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Stream events
|
|
105
|
+
for await (const event of AppKit.genie.sendMessage("demo", "Show revenue by region")) {
|
|
106
|
+
console.log(event.type, event);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Fetch full conversation
|
|
110
|
+
const history = await AppKit.genie.getConversation("demo", "conversation-id");
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Frontend components[](#frontend-components "Direct link to Frontend components")
|
|
115
|
+
|
|
116
|
+
The `@databricks/appkit-ui` package provides ready-to-use React components for Genie:
|
|
117
|
+
|
|
118
|
+
### GenieChat[](#geniechat "Direct link to GenieChat")
|
|
119
|
+
|
|
120
|
+
A full-featured chat interface that handles streaming, history, and reconnection:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { GenieChat } from "@databricks/appkit-ui/react";
|
|
124
|
+
|
|
125
|
+
function GeniePage() {
|
|
126
|
+
return (
|
|
127
|
+
<div style={{ height: 600 }}>
|
|
128
|
+
<GenieChat alias="demo" />
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The `alias` prop must match a key in the `spaces` configuration on the server.
|
|
136
|
+
|
|
137
|
+
### useGenieChat hook[](#usegeniechat-hook "Direct link to useGenieChat hook")
|
|
138
|
+
|
|
139
|
+
For custom chat UIs, use the `useGenieChat` hook directly:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { useGenieChat } from "@databricks/appkit-ui/react";
|
|
143
|
+
|
|
144
|
+
function CustomChat() {
|
|
145
|
+
const { messages, status, sendMessage, reset } = useGenieChat({
|
|
146
|
+
alias: "demo",
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
{messages.map((msg) => (
|
|
152
|
+
<div key={msg.id}>{msg.content}</div>
|
|
153
|
+
))}
|
|
154
|
+
<button onClick={() => sendMessage("Show top customers")}>Ask</button>
|
|
155
|
+
<button onClick={reset}>New conversation</button>
|
|
156
|
+
</>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
See the [GenieChat](./docs/api/appkit-ui/genie/GenieChat.md) component reference for the full props API.
|
package/docs/plugins.md
CHANGED
|
@@ -9,12 +9,13 @@ For complete API documentation, see the [`Plugin`](./docs/api/appkit/Class.Plugi
|
|
|
9
9
|
Configure plugins when creating your AppKit instance:
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { createApp, server, analytics } from "@databricks/appkit";
|
|
12
|
+
import { createApp, server, analytics, genie } from "@databricks/appkit";
|
|
13
13
|
|
|
14
14
|
const AppKit = await createApp({
|
|
15
15
|
plugins: [
|
|
16
16
|
server({ port: 8000 }),
|
|
17
17
|
analytics(),
|
|
18
|
+
genie(),
|
|
18
19
|
],
|
|
19
20
|
});
|
|
20
21
|
|
package/llms.txt
CHANGED
|
@@ -44,6 +44,7 @@ npx @databricks/appkit docs <query>
|
|
|
44
44
|
- [Caching](./docs/plugins/caching.md): AppKit provides both global and plugin-level caching capabilities.
|
|
45
45
|
- [Creating custom plugins](./docs/plugins/custom-plugins.md): If you need custom API routes or background logic, implement an AppKit plugin. The fastest way is to use the CLI:
|
|
46
46
|
- [Execution context](./docs/plugins/execution-context.md): AppKit manages Databricks authentication via two contexts:
|
|
47
|
+
- [Genie plugin](./docs/plugins/genie.md): Integrates Databricks AI/BI Genie spaces into your AppKit application, enabling natural language data queries via a conversational interface.
|
|
47
48
|
- [Lakebase plugin](./docs/plugins/lakebase.md): Currently, the Lakebase plugin currently requires a one-time manual setup to connect your Databricks App with your Lakebase database. An automated setup process is planned for an upcoming future release.
|
|
48
49
|
- [Plugin management](./docs/plugins/plugin-management.md): AppKit includes a CLI for managing plugins. All commands are available under npx @databricks/appkit plugin.
|
|
49
50
|
- [Server plugin](./docs/plugins/server.md): Provides HTTP server capabilities with development and production modes.
|