@dremio/js-sdk 0.42.0 → 0.43.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/README.md +209 -0
- package/dist/cloud/ai/AIResource.d.ts +716 -17
- package/dist/cloud/ai/AIResource.js +40 -18
- package/dist/cloud/ai/AIResource.js.map +1 -1
- package/dist/cloud/ai/DremioModelProvider.d.ts +1 -1
- package/dist/cloud/ai/DremioModelProvider.js +6 -13
- package/dist/cloud/ai/DremioModelProvider.js.map +1 -1
- package/dist/cloud/ai/modelProviderCodec.d.ts +12 -0
- package/dist/cloud/replaceOriginResource.js +4 -0
- package/dist/cloud/replaceOriginResource.js.map +1 -1
- package/dist/common/ConflictResolver.d.ts +9 -1
- package/dist/common/ConflictResolver.js +10 -1
- package/dist/common/ConflictResolver.js.map +1 -1
- package/dist/common/refineRfc9557Schema.d.ts +1 -0
- package/dist/common/refineRfc9557Schema.js +26 -0
- package/dist/common/refineRfc9557Schema.js.map +1 -0
- package/dist/common/sharedExports.d.ts +1 -0
- package/dist/common/sharedExports.js +1 -0
- package/dist/common/sharedExports.js.map +1 -1
- package/dist/enterprise/Dremio.d.ts +1 -1
- package/dist/enterprise/Dremio.js +3 -2
- package/dist/enterprise/Dremio.js.map +1 -1
- package/dist/enterprise/ai/AIResource.d.ts +699 -18
- package/dist/enterprise/ai/AIResource.js +41 -19
- package/dist/enterprise/ai/AIResource.js.map +1 -1
- package/dist/enterprise/ai/chat/ChatSession.d.ts +4 -25
- package/dist/enterprise/ai/chat/ChatSession.js +6 -55
- package/dist/enterprise/ai/chat/ChatSession.js.map +1 -1
- package/dist/enterprise/ai/chat/UserChatMessage.d.ts +38 -22
- package/dist/enterprise/ai/chat/UserChatMessage.js +33 -41
- package/dist/enterprise/ai/chat/UserChatMessage.js.map +1 -1
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +169 -11
- package/dist/enterprise/ai/chat/chatEventSchema.js +183 -35
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatPartialResponse.d.ts +0 -6
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.d.ts +6 -6
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js +2 -2
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js.map +1 -1
- package/dist/enterprise/ai/chat/index.d.ts +0 -3
- package/dist/enterprise/ai/chat/index.js +0 -1
- package/dist/enterprise/ai/chat/index.js.map +1 -1
- package/dist/enterprise/ai/chat/methods/sendChatMessage.js +4 -1
- package/dist/enterprise/ai/chat/methods/sendChatMessage.js.map +1 -1
- package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.d.ts +1 -2
- package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.js.map +1 -1
- package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.d.ts +1 -2
- package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js +0 -1
- package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js.map +1 -1
- package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.d.ts +1 -2
- package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js +0 -1
- package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js.map +1 -1
- package/dist/enterprise/ai/conversations/AgentConversation.d.ts +215 -0
- package/dist/enterprise/ai/conversations/AgentConversation.js +180 -0
- package/dist/enterprise/ai/conversations/AgentConversation.js.map +1 -0
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.d.ts +22 -0
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js +62 -0
- package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js.map +1 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +682 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.js +354 -0
- package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/createConversation.d.ts +28 -0
- package/dist/enterprise/ai/conversations/methods/createConversation.js +68 -0
- package/dist/enterprise/ai/conversations/methods/createConversation.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/createExchangeRun.d.ts +16 -0
- package/dist/enterprise/ai/conversations/methods/createExchangeRun.js +36 -0
- package/dist/enterprise/ai/conversations/methods/createExchangeRun.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/deleteConversation.d.ts +2 -0
- package/dist/enterprise/ai/conversations/methods/deleteConversation.js +24 -0
- package/dist/enterprise/ai/conversations/methods/deleteConversation.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/listConversations.d.ts +8 -0
- package/dist/enterprise/ai/conversations/methods/listConversations.js +30 -0
- package/dist/enterprise/ai/conversations/methods/listConversations.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversation.d.ts +12 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversation.js +29 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversation.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +86 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js +32 -0
- package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/stopExchangeRun.d.ts +2 -0
- package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js +24 -0
- package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/streamRunEvents.d.ts +6 -0
- package/dist/enterprise/ai/conversations/methods/streamRunEvents.js +33 -0
- package/dist/enterprise/ai/conversations/methods/streamRunEvents.js.map +1 -0
- package/dist/enterprise/ai/conversations/methods/updateConversation.d.ts +15 -0
- package/dist/enterprise/ai/conversations/methods/updateConversation.js +35 -0
- package/dist/enterprise/ai/conversations/methods/updateConversation.js.map +1 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +17 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.js +74 -0
- package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -0
- package/dist/enterprise/ai/index.d.ts +5 -1
- package/dist/enterprise/ai/index.js +4 -1
- package/dist/enterprise/ai/index.js.map +1 -1
- package/dist/enterprise/ai/modelProvider/ModelProvider.d.ts +15 -1
- package/dist/enterprise/ai/modelProvider/ModelProvider.js +12 -1
- package/dist/enterprise/ai/modelProvider/ModelProvider.js.map +1 -1
- package/dist/enterprise/ai/modelProvider/modelProviderCodec.d.ts +40 -0
- package/dist/enterprise/ai/modelProvider/modelProviderCodec.js +10 -1
- package/dist/enterprise/ai/modelProvider/modelProviderCodec.js.map +1 -1
- package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.d.ts +21 -0
- package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js +17 -0
- package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js.map +1 -1
- package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -0
- package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js +1 -0
- package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js.map +1 -1
- package/dist-iife/cloud.js +21620 -6202
- package/dist-iife/community.js +14 -0
- package/dist-iife/enterprise.js +19404 -4038
- package/package.json +5 -2
- package/dist/enterprise/ai/chat/ChatSessionClient.d.ts +0 -18
- package/dist/enterprise/ai/chat/ChatSessionClient.js +0 -55
- package/dist/enterprise/ai/chat/ChatSessionClient.js.map +0 -1
- package/dist/enterprise/ai/chat/UserChatMessageContent.d.ts +0 -19
- package/dist/enterprise/ai/chat/UserChatMessageContent.js +0 -44
- package/dist/enterprise/ai/chat/UserChatMessageContent.js.map +0 -1
package/README.md
CHANGED
|
@@ -132,6 +132,7 @@ API responses are automatically converted to native JavaScript/TypeScript types:
|
|
|
132
132
|
|
|
133
133
|
- [Configuration](#configuration)
|
|
134
134
|
- [Authentication](#authentication)
|
|
135
|
+
- [AI Agent](#ai-agent)
|
|
135
136
|
- [Catalog](#catalog)
|
|
136
137
|
- [Engine Rules](#engine-rules)
|
|
137
138
|
- [Engines](#engines)
|
|
@@ -242,6 +243,214 @@ const dremio = new Dremio({
|
|
|
242
243
|
});
|
|
243
244
|
```
|
|
244
245
|
|
|
246
|
+
## AI Agent
|
|
247
|
+
|
|
248
|
+
### `AgentConversation`
|
|
249
|
+
|
|
250
|
+
Represents a conversation with the Dremio AI Agent.
|
|
251
|
+
|
|
252
|
+
#### Properties
|
|
253
|
+
|
|
254
|
+
- `id: string` - Unique identifier for the conversation
|
|
255
|
+
- `title: string` - The conversation title
|
|
256
|
+
- `createdAt: Temporal.Instant` - When the conversation was created
|
|
257
|
+
- `modifiedAt: Temporal.Instant` - When the conversation was last modified
|
|
258
|
+
- `modelName: string | null` - The AI model name last used for this conversation
|
|
259
|
+
- `modelProviderId: string | null` - The AI model provider ID last used for this conversation
|
|
260
|
+
|
|
261
|
+
#### `AgentConversation` implements the [`Observable` contract](https://github.com/WICG/observable) using `Symbol.observable`:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
import { from } from "rxjs";
|
|
265
|
+
|
|
266
|
+
from(conversation).subscribe((chatEvent) => {
|
|
267
|
+
console.log(chatEvent);
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Create an `AgentConversation`
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const conversation = await dremio.ai("PROJECT_ID").createConversation({
|
|
275
|
+
message: new UserChatMessage(
|
|
276
|
+
new UserChatMessageStringContent(
|
|
277
|
+
"Can you help me visualize the data in the Citibike sample dataset?",
|
|
278
|
+
),
|
|
279
|
+
),
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### Retrieve `AgentConversation` by ID
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
const conversation = await dremio
|
|
287
|
+
.ai("PROJECT_ID")
|
|
288
|
+
.retrieveConversation("CONVERSATION_ID");
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### Update `AgentConversation`
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
const result = await conversation.update({ title: "New title" });
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### Delete `AgentConversation`
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
await conversation.delete();
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### List all `AgentConversation`s
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
for await (const conversation of dremio
|
|
307
|
+
.ai("PROJECT_ID")
|
|
308
|
+
.listConversations()
|
|
309
|
+
.data()) {
|
|
310
|
+
console.log(conversation);
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### Send message to `AgentConversation`
|
|
315
|
+
|
|
316
|
+
To send a message to the Agent, use the `startRun()` method:
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
await conversation.startRun({
|
|
320
|
+
message: new UserChatMessage(
|
|
321
|
+
new UserChatMessageStringContent(
|
|
322
|
+
"Please adjust the x-axis range to show only 2025-2026",
|
|
323
|
+
),
|
|
324
|
+
),
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `AgentConversationSnapshotBuilder`
|
|
329
|
+
|
|
330
|
+
Compiles a sequence of `ChatEvent`s into a structured view of the current conversation state.
|
|
331
|
+
|
|
332
|
+
#### Building a Snapshot
|
|
333
|
+
|
|
334
|
+
Create a snapshot from existing conversation history:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
const conversation = (
|
|
338
|
+
await dremio.ai("PROJECT_ID").retrieveConversation("CONVERSATION_ID")
|
|
339
|
+
).unwrap();
|
|
340
|
+
|
|
341
|
+
const conversationSnapshot = AgentConversationSnapshotBuilder.fromChatEvents(
|
|
342
|
+
conversation.id,
|
|
343
|
+
(await conversation.history()).unwrap(),
|
|
344
|
+
);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### Adding Events in Real-Time
|
|
348
|
+
|
|
349
|
+
Monitor chat events as they stream in and add them to the snapshot:
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
const runId = await conversation
|
|
353
|
+
.startRun({
|
|
354
|
+
message: new UserChatMessage(
|
|
355
|
+
new UserChatMessageStringContent(
|
|
356
|
+
"What data is available to me in Dremio?",
|
|
357
|
+
),
|
|
358
|
+
),
|
|
359
|
+
})
|
|
360
|
+
.then((res) => res.unwrap());
|
|
361
|
+
|
|
362
|
+
conversation.runEvents$(runId).subscribe((chatEvent) => {
|
|
363
|
+
conversationSnapshot.addChatEvent(chatEvent);
|
|
364
|
+
console.log(conversationSnapshot.get(runId)!.toJSON());
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### Accessing Snapshot Data
|
|
369
|
+
|
|
370
|
+
The snapshot is iterable and provides access to exchanges:
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
// Iterate through all exchanges
|
|
374
|
+
for (const exchange of conversationSnapshot) {
|
|
375
|
+
console.log("Exchange ID:", exchange.id);
|
|
376
|
+
for (const message of exchange.messages) {
|
|
377
|
+
console.log("Message:", message);
|
|
378
|
+
}
|
|
379
|
+
for (const toolCall of exchange.toolCalls) {
|
|
380
|
+
console.log("Tool Call:", toolCall.id, toolCall.state);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Get a specific exchange
|
|
385
|
+
const exchange = conversationSnapshot.get(runId);
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### Snapshot Methods
|
|
389
|
+
|
|
390
|
+
- `length: number` - Get the number of exchanges in the snapshot
|
|
391
|
+
- `clone(): AgentConversationSnapshotBuilder` - Create a deep clone of the builder
|
|
392
|
+
- `slice(startExchangeId, endExchangeId?)` - Get a shallow clone containing exchanges in a range
|
|
393
|
+
- `toJSON()` - Serialize the snapshot to JSON
|
|
394
|
+
|
|
395
|
+
#### Snapshot Output Example
|
|
396
|
+
|
|
397
|
+
The `toJSON()` method returns an array of exchanges with their messages and tool calls:
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
[
|
|
401
|
+
{
|
|
402
|
+
"id": "run-id-1",
|
|
403
|
+
"messages": [
|
|
404
|
+
{
|
|
405
|
+
"id": "msg-1",
|
|
406
|
+
"runId": "run-id-1",
|
|
407
|
+
"conversationId": "conv-id",
|
|
408
|
+
"role": "user",
|
|
409
|
+
"content": {
|
|
410
|
+
"chunkType": "userMessage",
|
|
411
|
+
"text": "What data is available?"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"id": "msg-2",
|
|
416
|
+
"runId": "run-id-1",
|
|
417
|
+
"conversationId": "conv-id",
|
|
418
|
+
"role": "agent",
|
|
419
|
+
"content": {
|
|
420
|
+
"chunkType": "model",
|
|
421
|
+
"name": "modelGeneric",
|
|
422
|
+
"result": {
|
|
423
|
+
"text": "Here are the available datasets..."
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
"toolCalls": [
|
|
429
|
+
{
|
|
430
|
+
"id": "tool-call-1",
|
|
431
|
+
"state": "success",
|
|
432
|
+
"request": {
|
|
433
|
+
"content": {
|
|
434
|
+
"chunkType": "toolRequest",
|
|
435
|
+
"name": "queryTool",
|
|
436
|
+
"arguments": { "query": "SELECT * FROM schemas" }
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"result": {
|
|
440
|
+
"content": {
|
|
441
|
+
"chunkType": "toolResponse",
|
|
442
|
+
"name": "queryTool",
|
|
443
|
+
"result": {
|
|
444
|
+
"rows": [{ "schema_name": "public" }]
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
]
|
|
452
|
+
```
|
|
453
|
+
|
|
245
454
|
## Catalog
|
|
246
455
|
|
|
247
456
|
### `CatalogReference` Interface
|