@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.
Files changed (115) hide show
  1. package/README.md +209 -0
  2. package/dist/cloud/ai/AIResource.d.ts +716 -17
  3. package/dist/cloud/ai/AIResource.js +40 -18
  4. package/dist/cloud/ai/AIResource.js.map +1 -1
  5. package/dist/cloud/ai/DremioModelProvider.d.ts +1 -1
  6. package/dist/cloud/ai/DremioModelProvider.js +6 -13
  7. package/dist/cloud/ai/DremioModelProvider.js.map +1 -1
  8. package/dist/cloud/ai/modelProviderCodec.d.ts +12 -0
  9. package/dist/cloud/replaceOriginResource.js +4 -0
  10. package/dist/cloud/replaceOriginResource.js.map +1 -1
  11. package/dist/common/ConflictResolver.d.ts +9 -1
  12. package/dist/common/ConflictResolver.js +10 -1
  13. package/dist/common/ConflictResolver.js.map +1 -1
  14. package/dist/common/refineRfc9557Schema.d.ts +1 -0
  15. package/dist/common/refineRfc9557Schema.js +26 -0
  16. package/dist/common/refineRfc9557Schema.js.map +1 -0
  17. package/dist/common/sharedExports.d.ts +1 -0
  18. package/dist/common/sharedExports.js +1 -0
  19. package/dist/common/sharedExports.js.map +1 -1
  20. package/dist/enterprise/Dremio.d.ts +1 -1
  21. package/dist/enterprise/Dremio.js +3 -2
  22. package/dist/enterprise/Dremio.js.map +1 -1
  23. package/dist/enterprise/ai/AIResource.d.ts +699 -18
  24. package/dist/enterprise/ai/AIResource.js +41 -19
  25. package/dist/enterprise/ai/AIResource.js.map +1 -1
  26. package/dist/enterprise/ai/chat/ChatSession.d.ts +4 -25
  27. package/dist/enterprise/ai/chat/ChatSession.js +6 -55
  28. package/dist/enterprise/ai/chat/ChatSession.js.map +1 -1
  29. package/dist/enterprise/ai/chat/UserChatMessage.d.ts +38 -22
  30. package/dist/enterprise/ai/chat/UserChatMessage.js +33 -41
  31. package/dist/enterprise/ai/chat/UserChatMessage.js.map +1 -1
  32. package/dist/enterprise/ai/chat/chatEventSchema.d.ts +169 -11
  33. package/dist/enterprise/ai/chat/chatEventSchema.js +183 -35
  34. package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
  35. package/dist/enterprise/ai/chat/eventWrappers/AgentChatPartialResponse.d.ts +0 -6
  36. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.d.ts +6 -6
  37. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js +2 -2
  38. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js.map +1 -1
  39. package/dist/enterprise/ai/chat/index.d.ts +0 -3
  40. package/dist/enterprise/ai/chat/index.js +0 -1
  41. package/dist/enterprise/ai/chat/index.js.map +1 -1
  42. package/dist/enterprise/ai/chat/methods/sendChatMessage.js +4 -1
  43. package/dist/enterprise/ai/chat/methods/sendChatMessage.js.map +1 -1
  44. package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.d.ts +1 -2
  45. package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.js.map +1 -1
  46. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.d.ts +1 -2
  47. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js +0 -1
  48. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js.map +1 -1
  49. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.d.ts +1 -2
  50. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js +0 -1
  51. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js.map +1 -1
  52. package/dist/enterprise/ai/conversations/AgentConversation.d.ts +215 -0
  53. package/dist/enterprise/ai/conversations/AgentConversation.js +180 -0
  54. package/dist/enterprise/ai/conversations/AgentConversation.js.map +1 -0
  55. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.d.ts +22 -0
  56. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js +62 -0
  57. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js.map +1 -0
  58. package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +682 -0
  59. package/dist/enterprise/ai/conversations/createConversationMachine.js +354 -0
  60. package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -0
  61. package/dist/enterprise/ai/conversations/methods/createConversation.d.ts +28 -0
  62. package/dist/enterprise/ai/conversations/methods/createConversation.js +68 -0
  63. package/dist/enterprise/ai/conversations/methods/createConversation.js.map +1 -0
  64. package/dist/enterprise/ai/conversations/methods/createExchangeRun.d.ts +16 -0
  65. package/dist/enterprise/ai/conversations/methods/createExchangeRun.js +36 -0
  66. package/dist/enterprise/ai/conversations/methods/createExchangeRun.js.map +1 -0
  67. package/dist/enterprise/ai/conversations/methods/deleteConversation.d.ts +2 -0
  68. package/dist/enterprise/ai/conversations/methods/deleteConversation.js +24 -0
  69. package/dist/enterprise/ai/conversations/methods/deleteConversation.js.map +1 -0
  70. package/dist/enterprise/ai/conversations/methods/listConversations.d.ts +8 -0
  71. package/dist/enterprise/ai/conversations/methods/listConversations.js +30 -0
  72. package/dist/enterprise/ai/conversations/methods/listConversations.js.map +1 -0
  73. package/dist/enterprise/ai/conversations/methods/retrieveConversation.d.ts +12 -0
  74. package/dist/enterprise/ai/conversations/methods/retrieveConversation.js +29 -0
  75. package/dist/enterprise/ai/conversations/methods/retrieveConversation.js.map +1 -0
  76. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +86 -0
  77. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js +32 -0
  78. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js.map +1 -0
  79. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.d.ts +2 -0
  80. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js +24 -0
  81. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js.map +1 -0
  82. package/dist/enterprise/ai/conversations/methods/streamRunEvents.d.ts +6 -0
  83. package/dist/enterprise/ai/conversations/methods/streamRunEvents.js +33 -0
  84. package/dist/enterprise/ai/conversations/methods/streamRunEvents.js.map +1 -0
  85. package/dist/enterprise/ai/conversations/methods/updateConversation.d.ts +15 -0
  86. package/dist/enterprise/ai/conversations/methods/updateConversation.js +35 -0
  87. package/dist/enterprise/ai/conversations/methods/updateConversation.js.map +1 -0
  88. package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +17 -0
  89. package/dist/enterprise/ai/conversations/reduceChatEvents.js +74 -0
  90. package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -0
  91. package/dist/enterprise/ai/index.d.ts +5 -1
  92. package/dist/enterprise/ai/index.js +4 -1
  93. package/dist/enterprise/ai/index.js.map +1 -1
  94. package/dist/enterprise/ai/modelProvider/ModelProvider.d.ts +15 -1
  95. package/dist/enterprise/ai/modelProvider/ModelProvider.js +12 -1
  96. package/dist/enterprise/ai/modelProvider/ModelProvider.js.map +1 -1
  97. package/dist/enterprise/ai/modelProvider/modelProviderCodec.d.ts +40 -0
  98. package/dist/enterprise/ai/modelProvider/modelProviderCodec.js +10 -1
  99. package/dist/enterprise/ai/modelProvider/modelProviderCodec.js.map +1 -1
  100. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.d.ts +21 -0
  101. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js +17 -0
  102. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js.map +1 -1
  103. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -0
  104. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js +1 -0
  105. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js.map +1 -1
  106. package/dist-iife/cloud.js +21620 -6202
  107. package/dist-iife/community.js +14 -0
  108. package/dist-iife/enterprise.js +19404 -4038
  109. package/package.json +5 -2
  110. package/dist/enterprise/ai/chat/ChatSessionClient.d.ts +0 -18
  111. package/dist/enterprise/ai/chat/ChatSessionClient.js +0 -55
  112. package/dist/enterprise/ai/chat/ChatSessionClient.js.map +0 -1
  113. package/dist/enterprise/ai/chat/UserChatMessageContent.d.ts +0 -19
  114. package/dist/enterprise/ai/chat/UserChatMessageContent.js +0 -44
  115. 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