@databricks/ai-sdk-provider 0.2.3 → 0.3.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 +59 -49
- package/dist/index.cjs +332 -254
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -33
- package/dist/index.d.cts.map +1 -1
- package/dist/{index.d.ts → index.d.mts} +23 -34
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +293 -189
- package/dist/index.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
const __ai_sdk_provider_utils = __toESM(require("@ai-sdk/provider-utils"));
|
|
26
|
-
const zod_v4 = __toESM(require("zod/v4"));
|
|
27
|
-
const node_crypto = __toESM(require("node:crypto"));
|
|
28
|
-
const __ai_sdk_provider = __toESM(require("@ai-sdk/provider"));
|
|
1
|
+
let _ai_sdk_provider_utils = require("@ai-sdk/provider-utils");
|
|
2
|
+
let zod_v4 = require("zod/v4");
|
|
3
|
+
let node_crypto = require("node:crypto");
|
|
4
|
+
let _ai_sdk_provider = require("@ai-sdk/provider");
|
|
29
5
|
|
|
30
6
|
//#region src/chat-agent-language-model/chat-agent-schema.ts
|
|
31
7
|
const chatAgentToolCallSchema = zod_v4.z.object({
|
|
@@ -70,26 +46,6 @@ const chatAgentResponseSchema = zod_v4.z.object({
|
|
|
70
46
|
messages: zod_v4.z.array(chatAgentMessageSchema)
|
|
71
47
|
});
|
|
72
48
|
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/tools.ts
|
|
75
|
-
const DATABRICKS_TOOL_CALL_ID = "databricks-tool-call";
|
|
76
|
-
/**
|
|
77
|
-
* The AI-SDK requires that tools used by the model are defined ahead of time.
|
|
78
|
-
*
|
|
79
|
-
* Since tool calls can be orchestrated by Databricks' agents we don't know the name, input, or output schemas
|
|
80
|
-
* of the tools until the model is called.
|
|
81
|
-
*
|
|
82
|
-
* In the DatabricksProvider we transform all tool calls to fit this definition, and keep the
|
|
83
|
-
* original name as part of the metadata. This allows us to parse any tool orchestrated by Databricks' agents,
|
|
84
|
-
* while still being able to render the tool call and result in the UI, and pass it back to the model with the correct name.
|
|
85
|
-
*/
|
|
86
|
-
const DATABRICKS_TOOL_DEFINITION = {
|
|
87
|
-
name: DATABRICKS_TOOL_CALL_ID,
|
|
88
|
-
description: "Databricks tool call",
|
|
89
|
-
inputSchema: zod_v4.z.any(),
|
|
90
|
-
outputSchema: zod_v4.z.any()
|
|
91
|
-
};
|
|
92
|
-
|
|
93
49
|
//#endregion
|
|
94
50
|
//#region src/chat-agent-language-model/chat-agent-convert-to-message-parts.ts
|
|
95
51
|
const convertChatAgentChunkToMessagePart = (chunk) => {
|
|
@@ -105,14 +61,16 @@ const convertChatAgentChunkToMessagePart = (chunk) => {
|
|
|
105
61
|
type: "tool-call",
|
|
106
62
|
toolCallId: toolCall.id,
|
|
107
63
|
input: toolCall.function.arguments,
|
|
108
|
-
toolName: toolCall.function.name
|
|
64
|
+
toolName: toolCall.function.name,
|
|
65
|
+
dynamic: true,
|
|
66
|
+
providerExecuted: true
|
|
109
67
|
});
|
|
110
68
|
});
|
|
111
69
|
} else if (chunk.delta.role === "tool") parts.push({
|
|
112
70
|
type: "tool-result",
|
|
113
71
|
toolCallId: chunk.delta.tool_call_id,
|
|
114
72
|
result: chunk.delta.content,
|
|
115
|
-
toolName:
|
|
73
|
+
toolName: chunk.delta.name ?? "unknown"
|
|
116
74
|
});
|
|
117
75
|
return parts;
|
|
118
76
|
};
|
|
@@ -127,20 +85,22 @@ const convertChatAgentResponseToMessagePart = (response) => {
|
|
|
127
85
|
type: "tool-call",
|
|
128
86
|
toolCallId: part.id,
|
|
129
87
|
input: part.function.arguments,
|
|
130
|
-
toolName: part.function.name
|
|
88
|
+
toolName: part.function.name,
|
|
89
|
+
dynamic: true,
|
|
90
|
+
providerExecuted: true
|
|
131
91
|
});
|
|
132
92
|
} else if (message.role === "tool") parts.push({
|
|
133
93
|
type: "tool-result",
|
|
134
94
|
toolCallId: message.tool_call_id,
|
|
135
95
|
result: message.content,
|
|
136
|
-
toolName:
|
|
96
|
+
toolName: message.name ?? "unknown"
|
|
137
97
|
});
|
|
138
98
|
return parts;
|
|
139
99
|
};
|
|
140
100
|
|
|
141
101
|
//#endregion
|
|
142
102
|
//#region src/chat-agent-language-model/chat-agent-convert-to-input.ts
|
|
143
|
-
const
|
|
103
|
+
const convertLanguageModelV3PromptToChatAgentResponse = (prompt) => {
|
|
144
104
|
const messages = [];
|
|
145
105
|
let messageIndex = 0;
|
|
146
106
|
for (const msg of prompt) switch (msg.role) {
|
|
@@ -167,10 +127,9 @@ const convertLanguageModelV2PromptToChatAgentResponse = (prompt) => {
|
|
|
167
127
|
return messages;
|
|
168
128
|
};
|
|
169
129
|
const convertUserMessage$1 = (msg, messageIndex) => {
|
|
170
|
-
const text = (msg.content ?? []).filter((part) => part.type === "text").map((part) => part.text).join("\n");
|
|
171
130
|
return {
|
|
172
131
|
role: "user",
|
|
173
|
-
content: text,
|
|
132
|
+
content: (msg.content ?? []).filter((part) => part.type === "text").map((part) => part.text).join("\n"),
|
|
174
133
|
id: `user-${messageIndex}`
|
|
175
134
|
};
|
|
176
135
|
};
|
|
@@ -243,10 +202,7 @@ const convertToolResultOutput = (output) => {
|
|
|
243
202
|
function composeDatabricksStreamPartTransformers(...transformers) {
|
|
244
203
|
return (initialParts, last = null) => {
|
|
245
204
|
let currentParts = initialParts;
|
|
246
|
-
for (const fn of transformers)
|
|
247
|
-
const result = fn(currentParts, last);
|
|
248
|
-
currentParts = result.out;
|
|
249
|
-
}
|
|
205
|
+
for (const fn of transformers) currentParts = fn(currentParts, last).out;
|
|
250
206
|
return { out: currentParts };
|
|
251
207
|
};
|
|
252
208
|
}
|
|
@@ -263,8 +219,7 @@ const applyDeltaBoundaryTransform = (parts, last) => {
|
|
|
263
219
|
const incomingDeltaType = maybeGetDeltaType(incoming);
|
|
264
220
|
const incomingId = getPartId$1(incoming);
|
|
265
221
|
const lastId = getPartId$1(last);
|
|
266
|
-
|
|
267
|
-
if (incomingMatchesLast) {
|
|
222
|
+
if (Boolean(isDeltaPart(last) && isDeltaPart(incoming)) && Boolean(lastDeltaType && incomingDeltaType) && Boolean(lastDeltaType === incomingDeltaType) && Boolean(incomingId && lastId && incomingId === lastId)) {
|
|
268
223
|
out.push(incoming);
|
|
269
224
|
continue;
|
|
270
225
|
}
|
|
@@ -280,7 +235,6 @@ const applyDeltaBoundaryTransform = (parts, last) => {
|
|
|
280
235
|
continue;
|
|
281
236
|
}
|
|
282
237
|
out.push(incoming);
|
|
283
|
-
continue;
|
|
284
238
|
}
|
|
285
239
|
return { out };
|
|
286
240
|
};
|
|
@@ -299,7 +253,6 @@ const getDeltaType = (part) => {
|
|
|
299
253
|
const isDeltaPart = (part) => part?.type === "text-delta" || part?.type === "reasoning-delta";
|
|
300
254
|
const getPartId$1 = (part) => {
|
|
301
255
|
if (part && "id" in part) return part.id;
|
|
302
|
-
return void 0;
|
|
303
256
|
};
|
|
304
257
|
|
|
305
258
|
//#endregion
|
|
@@ -312,7 +265,7 @@ const getPartId$1 = (part) => {
|
|
|
312
265
|
*/
|
|
313
266
|
const getDatabricksLanguageModelTransformStream = () => {
|
|
314
267
|
let lastChunk = null;
|
|
315
|
-
const deltaEndByTypeAndId = new Set();
|
|
268
|
+
const deltaEndByTypeAndId = /* @__PURE__ */ new Set();
|
|
316
269
|
const transformerStreamParts = composeDatabricksStreamPartTransformers(applyDeltaBoundaryTransform);
|
|
317
270
|
return new TransformStream({
|
|
318
271
|
transform(chunk, controller) {
|
|
@@ -354,14 +307,13 @@ const getDeltaGroup = (type) => {
|
|
|
354
307
|
};
|
|
355
308
|
const getPartId = (part) => {
|
|
356
309
|
if ("id" in part) return part.id;
|
|
357
|
-
return void 0;
|
|
358
310
|
};
|
|
359
311
|
const makeEndKey = (id, group) => id && group ? `${group}:${id}` : null;
|
|
360
312
|
|
|
361
313
|
//#endregion
|
|
362
314
|
//#region src/chat-agent-language-model/chat-agent-language-model.ts
|
|
363
315
|
var DatabricksChatAgentLanguageModel = class {
|
|
364
|
-
specificationVersion = "
|
|
316
|
+
specificationVersion = "v3";
|
|
365
317
|
modelId;
|
|
366
318
|
config;
|
|
367
319
|
constructor(modelId, config) {
|
|
@@ -373,16 +325,15 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
373
325
|
}
|
|
374
326
|
supportedUrls = {};
|
|
375
327
|
async doGenerate(options) {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
failedResponseHandler: (0, __ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
328
|
+
const { value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
329
|
+
...this.getArgs({
|
|
330
|
+
config: this.config,
|
|
331
|
+
options,
|
|
332
|
+
stream: false,
|
|
333
|
+
modelId: this.modelId
|
|
334
|
+
}),
|
|
335
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createJsonResponseHandler)(chatAgentResponseSchema),
|
|
336
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
386
337
|
errorSchema: zod_v4.z.any(),
|
|
387
338
|
errorToMessage: (error) => JSON.stringify(error),
|
|
388
339
|
isRetryable: () => false
|
|
@@ -390,11 +341,22 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
390
341
|
});
|
|
391
342
|
return {
|
|
392
343
|
content: convertChatAgentResponseToMessagePart(response),
|
|
393
|
-
finishReason:
|
|
344
|
+
finishReason: {
|
|
345
|
+
raw: void 0,
|
|
346
|
+
unified: "stop"
|
|
347
|
+
},
|
|
394
348
|
usage: {
|
|
395
|
-
inputTokens:
|
|
396
|
-
|
|
397
|
-
|
|
349
|
+
inputTokens: {
|
|
350
|
+
total: 0,
|
|
351
|
+
noCache: 0,
|
|
352
|
+
cacheRead: 0,
|
|
353
|
+
cacheWrite: 0
|
|
354
|
+
},
|
|
355
|
+
outputTokens: {
|
|
356
|
+
total: 0,
|
|
357
|
+
text: 0,
|
|
358
|
+
reasoning: 0
|
|
359
|
+
}
|
|
398
360
|
},
|
|
399
361
|
warnings: []
|
|
400
362
|
};
|
|
@@ -406,16 +368,19 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
406
368
|
stream: true,
|
|
407
369
|
modelId: this.modelId
|
|
408
370
|
});
|
|
409
|
-
const { responseHeaders, value: response } = await (0,
|
|
371
|
+
const { responseHeaders, value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
410
372
|
...networkArgs,
|
|
411
|
-
failedResponseHandler: (0,
|
|
373
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
412
374
|
errorSchema: zod_v4.z.any(),
|
|
413
375
|
errorToMessage: (error) => JSON.stringify(error),
|
|
414
376
|
isRetryable: () => false
|
|
415
377
|
}),
|
|
416
|
-
successfulResponseHandler: (0,
|
|
378
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createEventSourceResponseHandler)(chatAgentChunkSchema)
|
|
417
379
|
});
|
|
418
|
-
let finishReason =
|
|
380
|
+
let finishReason = {
|
|
381
|
+
raw: void 0,
|
|
382
|
+
unified: "other"
|
|
383
|
+
};
|
|
419
384
|
return {
|
|
420
385
|
stream: response.pipeThrough(new TransformStream({
|
|
421
386
|
start(controller) {
|
|
@@ -430,7 +395,10 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
430
395
|
rawValue: chunk.rawValue
|
|
431
396
|
});
|
|
432
397
|
if (!chunk.success) {
|
|
433
|
-
finishReason =
|
|
398
|
+
finishReason = {
|
|
399
|
+
raw: void 0,
|
|
400
|
+
unified: "error"
|
|
401
|
+
};
|
|
434
402
|
controller.enqueue({
|
|
435
403
|
type: "error",
|
|
436
404
|
error: chunk.error
|
|
@@ -445,9 +413,17 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
445
413
|
type: "finish",
|
|
446
414
|
finishReason,
|
|
447
415
|
usage: {
|
|
448
|
-
inputTokens:
|
|
449
|
-
|
|
450
|
-
|
|
416
|
+
inputTokens: {
|
|
417
|
+
total: 0,
|
|
418
|
+
noCache: 0,
|
|
419
|
+
cacheRead: 0,
|
|
420
|
+
cacheWrite: 0
|
|
421
|
+
},
|
|
422
|
+
outputTokens: {
|
|
423
|
+
total: 0,
|
|
424
|
+
text: 0,
|
|
425
|
+
reasoning: 0
|
|
426
|
+
}
|
|
451
427
|
}
|
|
452
428
|
});
|
|
453
429
|
}
|
|
@@ -461,10 +437,10 @@ var DatabricksChatAgentLanguageModel = class {
|
|
|
461
437
|
body: {
|
|
462
438
|
model: modelId,
|
|
463
439
|
stream,
|
|
464
|
-
messages:
|
|
440
|
+
messages: convertLanguageModelV3PromptToChatAgentResponse(options.prompt)
|
|
465
441
|
},
|
|
466
442
|
url: config.url({ path: "/completions" }),
|
|
467
|
-
headers: (0,
|
|
443
|
+
headers: (0, _ai_sdk_provider_utils.combineHeaders)(config.headers(), options.headers),
|
|
468
444
|
fetch: config.fetch,
|
|
469
445
|
abortSignal: options.abortSignal
|
|
470
446
|
};
|
|
@@ -692,7 +668,6 @@ function isMcpApprovalResponse(metadata) {
|
|
|
692
668
|
*/
|
|
693
669
|
function extractDatabricksMetadata(part) {
|
|
694
670
|
if ("callProviderMetadata" in part && part.callProviderMetadata?.databricks) return part.callProviderMetadata.databricks;
|
|
695
|
-
return void 0;
|
|
696
671
|
}
|
|
697
672
|
/**
|
|
698
673
|
* Extract the approval status boolean from an output object.
|
|
@@ -707,7 +682,6 @@ function extractDatabricksMetadata(part) {
|
|
|
707
682
|
*/
|
|
708
683
|
function extractApprovalStatus(output) {
|
|
709
684
|
if (isApprovalStatusOutput(output)) return output[MCP_APPROVAL_STATUS_KEY];
|
|
710
|
-
return void 0;
|
|
711
685
|
}
|
|
712
686
|
/**
|
|
713
687
|
* Extract approval status from a tool result's output value.
|
|
@@ -721,7 +695,6 @@ function extractApprovalStatusFromToolResult(output) {
|
|
|
721
695
|
const value = output.value[MCP_APPROVAL_STATUS_KEY];
|
|
722
696
|
if (typeof value === "boolean") return value;
|
|
723
697
|
}
|
|
724
|
-
return void 0;
|
|
725
698
|
}
|
|
726
699
|
/**
|
|
727
700
|
* Create an approval status output object.
|
|
@@ -757,7 +730,7 @@ function getMcpApprovalState(output) {
|
|
|
757
730
|
|
|
758
731
|
//#endregion
|
|
759
732
|
//#region src/responses-agent-language-model/responses-convert-to-message-parts.ts
|
|
760
|
-
const convertResponsesAgentChunkToMessagePart = (chunk) => {
|
|
733
|
+
const convertResponsesAgentChunkToMessagePart = (chunk, options = { useRemoteToolCalling: false }) => {
|
|
761
734
|
const parts = [];
|
|
762
735
|
if ("error" in chunk) {
|
|
763
736
|
parts.push({
|
|
@@ -787,12 +760,12 @@ const convertResponsesAgentChunkToMessagePart = (chunk) => {
|
|
|
787
760
|
parts.push({
|
|
788
761
|
type: "tool-result",
|
|
789
762
|
toolCallId: chunk.call_id,
|
|
790
|
-
result: chunk.output,
|
|
791
|
-
toolName:
|
|
763
|
+
result: chunk.output != null ? chunk.output : {},
|
|
764
|
+
toolName: options.toolNamesByCallId?.get(chunk.call_id) ?? "unknown"
|
|
792
765
|
});
|
|
793
766
|
break;
|
|
794
767
|
case "response.output_item.done":
|
|
795
|
-
parts.push(...convertOutputItemDone(chunk.item));
|
|
768
|
+
parts.push(...convertOutputItemDone(chunk.item, options));
|
|
796
769
|
break;
|
|
797
770
|
case "response.output_text.annotation.added":
|
|
798
771
|
parts.push({
|
|
@@ -813,7 +786,7 @@ const convertResponsesAgentChunkToMessagePart = (chunk) => {
|
|
|
813
786
|
}
|
|
814
787
|
return parts;
|
|
815
788
|
};
|
|
816
|
-
const convertOutputItemDone = (item) => {
|
|
789
|
+
const convertOutputItemDone = (item, options) => {
|
|
817
790
|
switch (item.type) {
|
|
818
791
|
case "message": {
|
|
819
792
|
const firstContent = item.content[0];
|
|
@@ -831,18 +804,19 @@ const convertOutputItemDone = (item) => {
|
|
|
831
804
|
case "function_call": return [{
|
|
832
805
|
type: "tool-call",
|
|
833
806
|
toolCallId: item.call_id,
|
|
834
|
-
toolName:
|
|
807
|
+
toolName: item.name,
|
|
835
808
|
input: item.arguments,
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
809
|
+
...options.useRemoteToolCalling && {
|
|
810
|
+
dynamic: true,
|
|
811
|
+
providerExecuted: true
|
|
812
|
+
},
|
|
813
|
+
providerMetadata: { databricks: { itemId: item.id } }
|
|
840
814
|
}];
|
|
841
815
|
case "function_call_output": return [{
|
|
842
816
|
type: "tool-result",
|
|
843
817
|
toolCallId: item.call_id,
|
|
844
|
-
result: item.output,
|
|
845
|
-
toolName:
|
|
818
|
+
result: item.output != null ? item.output : {},
|
|
819
|
+
toolName: options.toolNamesByCallId?.get(item.call_id) ?? "unknown"
|
|
846
820
|
}];
|
|
847
821
|
case "reasoning": {
|
|
848
822
|
const firstSummary = item.summary[0];
|
|
@@ -867,11 +841,14 @@ const convertOutputItemDone = (item) => {
|
|
|
867
841
|
case "mcp_approval_request": return [{
|
|
868
842
|
type: "tool-call",
|
|
869
843
|
toolCallId: item.id,
|
|
870
|
-
toolName:
|
|
844
|
+
toolName: item.name,
|
|
871
845
|
input: item.arguments,
|
|
846
|
+
...options.useRemoteToolCalling && {
|
|
847
|
+
dynamic: true,
|
|
848
|
+
providerExecuted: true
|
|
849
|
+
},
|
|
872
850
|
providerMetadata: { databricks: {
|
|
873
851
|
type: MCP_APPROVAL_REQUEST_TYPE,
|
|
874
|
-
toolName: item.name,
|
|
875
852
|
itemId: item.id,
|
|
876
853
|
serverLabel: item.server_label
|
|
877
854
|
} }
|
|
@@ -879,7 +856,7 @@ const convertOutputItemDone = (item) => {
|
|
|
879
856
|
case "mcp_approval_response": return [{
|
|
880
857
|
type: "tool-result",
|
|
881
858
|
toolCallId: item.approval_request_id,
|
|
882
|
-
toolName:
|
|
859
|
+
toolName: options.toolNamesByCallId?.get(item.approval_request_id) ?? "mcp_approval",
|
|
883
860
|
result: createApprovalStatusOutput(item.approve),
|
|
884
861
|
providerMetadata: { databricks: {
|
|
885
862
|
type: MCP_APPROVAL_RESPONSE_TYPE,
|
|
@@ -889,27 +866,30 @@ const convertOutputItemDone = (item) => {
|
|
|
889
866
|
default: return [];
|
|
890
867
|
}
|
|
891
868
|
};
|
|
892
|
-
const convertResponsesAgentResponseToMessagePart = (response) => {
|
|
869
|
+
const convertResponsesAgentResponseToMessagePart = (response, options = { useRemoteToolCalling: false }) => {
|
|
893
870
|
const parts = [];
|
|
871
|
+
const toolNamesByCallId = /* @__PURE__ */ new Map();
|
|
872
|
+
for (const output of response.output) if (output.type === "function_call") toolNamesByCallId.set(output.call_id, output.name);
|
|
873
|
+
else if (output.type === "mcp_approval_request") toolNamesByCallId.set(output.id, output.name);
|
|
894
874
|
for (const output of response.output) switch (output.type) {
|
|
895
|
-
case "message":
|
|
875
|
+
case "message":
|
|
896
876
|
for (const content of output.content) if (content.type === "output_text") parts.push({
|
|
897
877
|
type: "text",
|
|
898
878
|
text: content.text,
|
|
899
879
|
providerMetadata: { databricks: { itemId: output.id } }
|
|
900
880
|
});
|
|
901
881
|
break;
|
|
902
|
-
}
|
|
903
882
|
case "function_call":
|
|
904
883
|
parts.push({
|
|
905
884
|
type: "tool-call",
|
|
906
885
|
toolCallId: output.call_id,
|
|
907
|
-
toolName:
|
|
886
|
+
toolName: output.name,
|
|
908
887
|
input: output.arguments,
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}
|
|
888
|
+
...options.useRemoteToolCalling && {
|
|
889
|
+
dynamic: true,
|
|
890
|
+
providerExecuted: true
|
|
891
|
+
},
|
|
892
|
+
providerMetadata: { databricks: { itemId: output.id } }
|
|
913
893
|
});
|
|
914
894
|
break;
|
|
915
895
|
case "reasoning":
|
|
@@ -924,18 +904,17 @@ const convertResponsesAgentResponseToMessagePart = (response) => {
|
|
|
924
904
|
type: "tool-result",
|
|
925
905
|
result: output.output,
|
|
926
906
|
toolCallId: output.call_id,
|
|
927
|
-
toolName:
|
|
907
|
+
toolName: toolNamesByCallId.get(output.call_id) ?? "unknown"
|
|
928
908
|
});
|
|
929
909
|
break;
|
|
930
910
|
case "mcp_approval_request":
|
|
931
911
|
parts.push({
|
|
932
912
|
type: "tool-call",
|
|
933
913
|
toolCallId: output.id,
|
|
934
|
-
toolName:
|
|
914
|
+
toolName: output.name,
|
|
935
915
|
input: output.arguments,
|
|
936
916
|
providerMetadata: { databricks: {
|
|
937
917
|
type: MCP_APPROVAL_REQUEST_TYPE,
|
|
938
|
-
toolName: output.name,
|
|
939
918
|
itemId: output.id,
|
|
940
919
|
serverLabel: output.server_label
|
|
941
920
|
} }
|
|
@@ -945,7 +924,7 @@ const convertResponsesAgentResponseToMessagePart = (response) => {
|
|
|
945
924
|
parts.push({
|
|
946
925
|
type: "tool-result",
|
|
947
926
|
toolCallId: output.approval_request_id,
|
|
948
|
-
toolName:
|
|
927
|
+
toolName: toolNamesByCallId.get(output.approval_request_id) ?? "mcp_approval",
|
|
949
928
|
result: createApprovalStatusOutput(output.approve),
|
|
950
929
|
providerMetadata: { databricks: {
|
|
951
930
|
type: MCP_APPROVAL_RESPONSE_TYPE,
|
|
@@ -968,7 +947,7 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
968
947
|
return reduction;
|
|
969
948
|
}, {});
|
|
970
949
|
for (const { role, content } of prompt) switch (role) {
|
|
971
|
-
case "system":
|
|
950
|
+
case "system":
|
|
972
951
|
switch (systemMessageMode) {
|
|
973
952
|
case "system":
|
|
974
953
|
input.push({
|
|
@@ -994,7 +973,6 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
994
973
|
}
|
|
995
974
|
}
|
|
996
975
|
break;
|
|
997
|
-
}
|
|
998
976
|
case "user":
|
|
999
977
|
input.push({
|
|
1000
978
|
role: "user",
|
|
@@ -1004,21 +982,21 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
1004
982
|
type: "input_text",
|
|
1005
983
|
text: part.text
|
|
1006
984
|
};
|
|
1007
|
-
default: throw new
|
|
985
|
+
default: throw new _ai_sdk_provider.UnsupportedFunctionalityError({ functionality: `part ${JSON.stringify(part)}` });
|
|
1008
986
|
}
|
|
1009
987
|
})
|
|
1010
988
|
});
|
|
1011
989
|
break;
|
|
1012
990
|
case "assistant":
|
|
1013
991
|
for (const part of content) {
|
|
1014
|
-
const providerOptions = await (0,
|
|
992
|
+
const providerOptions = await (0, _ai_sdk_provider_utils.parseProviderOptions)({
|
|
1015
993
|
provider: "databricks",
|
|
1016
994
|
providerOptions: part.providerOptions,
|
|
1017
995
|
schema: ProviderOptionsSchema$1
|
|
1018
996
|
});
|
|
1019
997
|
const itemId = providerOptions?.itemId ?? void 0;
|
|
1020
998
|
switch (part.type) {
|
|
1021
|
-
case "text":
|
|
999
|
+
case "text":
|
|
1022
1000
|
input.push({
|
|
1023
1001
|
role: "assistant",
|
|
1024
1002
|
content: [{
|
|
@@ -1028,7 +1006,6 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
1028
1006
|
id: itemId
|
|
1029
1007
|
});
|
|
1030
1008
|
break;
|
|
1031
|
-
}
|
|
1032
1009
|
case "tool-call": {
|
|
1033
1010
|
const toolName = providerOptions?.toolName ?? part.toolName;
|
|
1034
1011
|
if (providerOptions?.type === MCP_APPROVAL_REQUEST_TYPE) {
|
|
@@ -1079,7 +1056,7 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
1079
1056
|
});
|
|
1080
1057
|
break;
|
|
1081
1058
|
}
|
|
1082
|
-
case "tool-result":
|
|
1059
|
+
case "tool-result":
|
|
1083
1060
|
if (providerOptions?.type === MCP_APPROVAL_RESPONSE_TYPE) {
|
|
1084
1061
|
const approvalRequestId = providerOptions?.approvalRequestId ?? part.toolCallId;
|
|
1085
1062
|
const approve = providerOptions?.approve ?? false;
|
|
@@ -1099,8 +1076,7 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
1099
1076
|
output: convertToolResultOutputToString(part.output)
|
|
1100
1077
|
});
|
|
1101
1078
|
break;
|
|
1102
|
-
|
|
1103
|
-
case "reasoning": {
|
|
1079
|
+
case "reasoning":
|
|
1104
1080
|
if (!itemId) break;
|
|
1105
1081
|
input.push({
|
|
1106
1082
|
type: "reasoning",
|
|
@@ -1111,7 +1087,6 @@ async function convertToResponsesInput({ prompt, systemMessageMode }) {
|
|
|
1111
1087
|
id: itemId
|
|
1112
1088
|
});
|
|
1113
1089
|
break;
|
|
1114
|
-
}
|
|
1115
1090
|
}
|
|
1116
1091
|
}
|
|
1117
1092
|
break;
|
|
@@ -1139,7 +1114,10 @@ const convertToolResultOutputToString = (output) => {
|
|
|
1139
1114
|
switch (output.type) {
|
|
1140
1115
|
case "text":
|
|
1141
1116
|
case "error-text": return output.value;
|
|
1142
|
-
|
|
1117
|
+
case "execution-denied": return output.reason ?? "Execution denied";
|
|
1118
|
+
case "json":
|
|
1119
|
+
case "error-json":
|
|
1120
|
+
case "content": return JSON.stringify(output.value);
|
|
1143
1121
|
}
|
|
1144
1122
|
};
|
|
1145
1123
|
|
|
@@ -1157,7 +1135,7 @@ function prepareResponsesTools({ tools, toolChoice }) {
|
|
|
1157
1135
|
};
|
|
1158
1136
|
const responsesTools = [];
|
|
1159
1137
|
for (const tool of tools) {
|
|
1160
|
-
if (tool.type === "provider
|
|
1138
|
+
if (tool.type === "provider") continue;
|
|
1161
1139
|
responsesTools.push({
|
|
1162
1140
|
type: "function",
|
|
1163
1141
|
name: tool.name,
|
|
@@ -1169,14 +1147,13 @@ function prepareResponsesTools({ tools, toolChoice }) {
|
|
|
1169
1147
|
tools: void 0,
|
|
1170
1148
|
toolChoice: void 0
|
|
1171
1149
|
};
|
|
1172
|
-
const convertedToolChoice = convertResponsesToolChoice(toolChoice);
|
|
1173
1150
|
return {
|
|
1174
1151
|
tools: responsesTools,
|
|
1175
|
-
toolChoice:
|
|
1152
|
+
toolChoice: convertResponsesToolChoice(toolChoice)
|
|
1176
1153
|
};
|
|
1177
1154
|
}
|
|
1178
1155
|
function convertResponsesToolChoice(toolChoice) {
|
|
1179
|
-
if (!toolChoice) return
|
|
1156
|
+
if (!toolChoice) return;
|
|
1180
1157
|
switch (toolChoice.type) {
|
|
1181
1158
|
case "auto": return "auto";
|
|
1182
1159
|
case "none": return "none";
|
|
@@ -1185,14 +1162,14 @@ function convertResponsesToolChoice(toolChoice) {
|
|
|
1185
1162
|
type: "function",
|
|
1186
1163
|
name: toolChoice.toolName
|
|
1187
1164
|
};
|
|
1188
|
-
default: return
|
|
1165
|
+
default: return;
|
|
1189
1166
|
}
|
|
1190
1167
|
}
|
|
1191
1168
|
|
|
1192
1169
|
//#endregion
|
|
1193
1170
|
//#region src/responses-agent-language-model/call-options-to-responses-args.ts
|
|
1194
1171
|
/**
|
|
1195
|
-
* Converts AI SDK
|
|
1172
|
+
* Converts AI SDK LanguageModelV3CallOptions to Databricks Responses API body parameters.
|
|
1196
1173
|
*
|
|
1197
1174
|
* Inspired by the getArgs method in:
|
|
1198
1175
|
* https://github.com/vercel/ai/blob/main/packages/openai/src/responses/openai-responses-language-model.ts#L118
|
|
@@ -1204,28 +1181,28 @@ function callOptionsToResponsesArgs(options) {
|
|
|
1204
1181
|
const warnings = [];
|
|
1205
1182
|
const databricksOptions = options.providerOptions?.databricks;
|
|
1206
1183
|
if (options.topK != null) warnings.push({
|
|
1207
|
-
type: "unsupported
|
|
1208
|
-
|
|
1184
|
+
type: "unsupported",
|
|
1185
|
+
feature: "topK",
|
|
1209
1186
|
details: "topK is not supported by the Databricks Responses API"
|
|
1210
1187
|
});
|
|
1211
1188
|
if (options.presencePenalty != null) warnings.push({
|
|
1212
|
-
type: "unsupported
|
|
1213
|
-
|
|
1189
|
+
type: "unsupported",
|
|
1190
|
+
feature: "presencePenalty",
|
|
1214
1191
|
details: "presencePenalty is not supported by the Databricks Responses API"
|
|
1215
1192
|
});
|
|
1216
1193
|
if (options.frequencyPenalty != null) warnings.push({
|
|
1217
|
-
type: "unsupported
|
|
1218
|
-
|
|
1194
|
+
type: "unsupported",
|
|
1195
|
+
feature: "frequencyPenalty",
|
|
1219
1196
|
details: "frequencyPenalty is not supported by the Databricks Responses API"
|
|
1220
1197
|
});
|
|
1221
1198
|
if (options.seed != null) warnings.push({
|
|
1222
|
-
type: "unsupported
|
|
1223
|
-
|
|
1199
|
+
type: "unsupported",
|
|
1200
|
+
feature: "seed",
|
|
1224
1201
|
details: "seed is not supported by the Databricks Responses API"
|
|
1225
1202
|
});
|
|
1226
1203
|
if (options.stopSequences != null && options.stopSequences.length > 0) warnings.push({
|
|
1227
|
-
type: "unsupported
|
|
1228
|
-
|
|
1204
|
+
type: "unsupported",
|
|
1205
|
+
feature: "stopSequences",
|
|
1229
1206
|
details: "stopSequences is not supported by the Databricks Responses API"
|
|
1230
1207
|
});
|
|
1231
1208
|
const args = {};
|
|
@@ -1261,16 +1238,27 @@ function callOptionsToResponsesArgs(options) {
|
|
|
1261
1238
|
//#endregion
|
|
1262
1239
|
//#region src/responses-agent-language-model/responses-agent-language-model.ts
|
|
1263
1240
|
function mapResponsesFinishReason({ finishReason, hasToolCalls }) {
|
|
1241
|
+
let unified;
|
|
1264
1242
|
switch (finishReason) {
|
|
1265
1243
|
case void 0:
|
|
1266
|
-
case null:
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1244
|
+
case null:
|
|
1245
|
+
unified = hasToolCalls ? "tool-calls" : "stop";
|
|
1246
|
+
break;
|
|
1247
|
+
case "max_output_tokens":
|
|
1248
|
+
unified = "length";
|
|
1249
|
+
break;
|
|
1250
|
+
case "content_filter":
|
|
1251
|
+
unified = "content-filter";
|
|
1252
|
+
break;
|
|
1253
|
+
default: unified = hasToolCalls ? "tool-calls" : "other";
|
|
1270
1254
|
}
|
|
1255
|
+
return {
|
|
1256
|
+
raw: finishReason ?? void 0,
|
|
1257
|
+
unified
|
|
1258
|
+
};
|
|
1271
1259
|
}
|
|
1272
1260
|
var DatabricksResponsesAgentLanguageModel = class {
|
|
1273
|
-
specificationVersion = "
|
|
1261
|
+
specificationVersion = "v3";
|
|
1274
1262
|
modelId;
|
|
1275
1263
|
config;
|
|
1276
1264
|
constructor(modelId, config) {
|
|
@@ -1282,16 +1270,16 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1282
1270
|
}
|
|
1283
1271
|
supportedUrls = {};
|
|
1284
1272
|
async doGenerate(options) {
|
|
1285
|
-
const { warnings
|
|
1273
|
+
const { warnings, ...networkArgs } = await this.getArgs({
|
|
1286
1274
|
config: this.config,
|
|
1287
1275
|
options,
|
|
1288
1276
|
stream: false,
|
|
1289
1277
|
modelId: this.modelId
|
|
1290
1278
|
});
|
|
1291
|
-
const { value: response } = await (0,
|
|
1279
|
+
const { value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
1292
1280
|
...networkArgs,
|
|
1293
|
-
successfulResponseHandler: (0,
|
|
1294
|
-
failedResponseHandler: (0,
|
|
1281
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createJsonResponseHandler)(responsesAgentResponseSchema),
|
|
1282
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
1295
1283
|
errorSchema: zod_v4.z.any(),
|
|
1296
1284
|
errorToMessage: (error) => JSON.stringify(error),
|
|
1297
1285
|
isRetryable: () => false
|
|
@@ -1306,37 +1294,58 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1306
1294
|
hasToolCalls
|
|
1307
1295
|
}),
|
|
1308
1296
|
usage: {
|
|
1309
|
-
inputTokens:
|
|
1310
|
-
|
|
1311
|
-
|
|
1297
|
+
inputTokens: {
|
|
1298
|
+
total: response.usage?.input_tokens ?? 0,
|
|
1299
|
+
noCache: 0,
|
|
1300
|
+
cacheRead: 0,
|
|
1301
|
+
cacheWrite: 0
|
|
1302
|
+
},
|
|
1303
|
+
outputTokens: {
|
|
1304
|
+
total: response.usage?.output_tokens ?? 0,
|
|
1305
|
+
text: 0,
|
|
1306
|
+
reasoning: 0
|
|
1307
|
+
}
|
|
1312
1308
|
},
|
|
1313
1309
|
warnings
|
|
1314
1310
|
};
|
|
1315
1311
|
}
|
|
1316
1312
|
async doStream(options) {
|
|
1317
|
-
const { warnings
|
|
1313
|
+
const { warnings, ...networkArgs } = await this.getArgs({
|
|
1318
1314
|
config: this.config,
|
|
1319
1315
|
options,
|
|
1320
1316
|
stream: true,
|
|
1321
1317
|
modelId: this.modelId
|
|
1322
1318
|
});
|
|
1323
|
-
const { responseHeaders, value: response } = await (0,
|
|
1319
|
+
const { responseHeaders, value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
1324
1320
|
...networkArgs,
|
|
1325
|
-
failedResponseHandler: (0,
|
|
1321
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
1326
1322
|
errorSchema: zod_v4.z.any(),
|
|
1327
1323
|
errorToMessage: (error) => JSON.stringify(error),
|
|
1328
1324
|
isRetryable: () => false
|
|
1329
1325
|
}),
|
|
1330
|
-
successfulResponseHandler: (0,
|
|
1326
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createEventSourceResponseHandler)(looseResponseAgentChunkSchema),
|
|
1331
1327
|
abortSignal: options.abortSignal
|
|
1332
1328
|
});
|
|
1333
|
-
let finishReason =
|
|
1329
|
+
let finishReason = {
|
|
1330
|
+
raw: void 0,
|
|
1331
|
+
unified: "stop"
|
|
1332
|
+
};
|
|
1334
1333
|
const usage = {
|
|
1335
|
-
inputTokens:
|
|
1336
|
-
|
|
1337
|
-
|
|
1334
|
+
inputTokens: {
|
|
1335
|
+
total: 0,
|
|
1336
|
+
noCache: 0,
|
|
1337
|
+
cacheRead: 0,
|
|
1338
|
+
cacheWrite: 0
|
|
1339
|
+
},
|
|
1340
|
+
outputTokens: {
|
|
1341
|
+
total: 0,
|
|
1342
|
+
text: 0,
|
|
1343
|
+
reasoning: 0
|
|
1344
|
+
}
|
|
1338
1345
|
};
|
|
1339
1346
|
const allParts = [];
|
|
1347
|
+
const useRemoteToolCalling = this.config.useRemoteToolCalling ?? false;
|
|
1348
|
+
const toolNamesByCallId = /* @__PURE__ */ new Map();
|
|
1340
1349
|
return {
|
|
1341
1350
|
stream: response.pipeThrough(new TransformStream({
|
|
1342
1351
|
start(controller) {
|
|
@@ -1351,7 +1360,10 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1351
1360
|
rawValue: chunk.rawValue
|
|
1352
1361
|
});
|
|
1353
1362
|
if (!chunk.success) {
|
|
1354
|
-
finishReason =
|
|
1363
|
+
finishReason = {
|
|
1364
|
+
raw: void 0,
|
|
1365
|
+
unified: "error"
|
|
1366
|
+
};
|
|
1355
1367
|
controller.enqueue({
|
|
1356
1368
|
type: "error",
|
|
1357
1369
|
error: chunk.error
|
|
@@ -1364,12 +1376,15 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1364
1376
|
finishReason: chunk.value.response.incomplete_details?.reason,
|
|
1365
1377
|
hasToolCalls
|
|
1366
1378
|
});
|
|
1367
|
-
usage.inputTokens = chunk.value.response.usage.input_tokens;
|
|
1368
|
-
usage.outputTokens = chunk.value.response.usage.output_tokens;
|
|
1369
|
-
usage.totalTokens = chunk.value.response.usage.total_tokens;
|
|
1379
|
+
usage.inputTokens.total = chunk.value.response.usage.input_tokens;
|
|
1380
|
+
usage.outputTokens.total = chunk.value.response.usage.output_tokens;
|
|
1370
1381
|
return;
|
|
1371
1382
|
}
|
|
1372
|
-
|
|
1383
|
+
if (chunk.value.type === "response.output_item.done" && chunk.value.item.type === "function_call") toolNamesByCallId.set(chunk.value.item.call_id, chunk.value.item.name);
|
|
1384
|
+
const parts = convertResponsesAgentChunkToMessagePart(chunk.value, {
|
|
1385
|
+
useRemoteToolCalling,
|
|
1386
|
+
toolNamesByCallId
|
|
1387
|
+
});
|
|
1373
1388
|
allParts.push(...parts);
|
|
1374
1389
|
/**
|
|
1375
1390
|
* Check if the last chunk was a tool result without a tool call
|
|
@@ -1384,19 +1399,33 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1384
1399
|
if (!matchingToolCallInParts && !matchingToolCallInStream) {
|
|
1385
1400
|
const toolCallFromPreviousMessages = options.prompt.flatMap((message) => {
|
|
1386
1401
|
if (typeof message.content === "string") return [];
|
|
1387
|
-
return message.content;
|
|
1388
|
-
}).find((p) => p.
|
|
1402
|
+
return message.content.filter((p) => p.type === "tool-call");
|
|
1403
|
+
}).find((p) => p.toolCallId === part.toolCallId);
|
|
1389
1404
|
if (!toolCallFromPreviousMessages) throw new Error("No matching tool call found in previous message");
|
|
1390
|
-
|
|
1391
|
-
|
|
1405
|
+
controller.enqueue({
|
|
1406
|
+
type: "tool-call",
|
|
1407
|
+
toolCallId: toolCallFromPreviousMessages.toolCallId,
|
|
1408
|
+
toolName: toolCallFromPreviousMessages.toolName,
|
|
1392
1409
|
input: JSON.stringify(toolCallFromPreviousMessages.input)
|
|
1393
1410
|
});
|
|
1394
1411
|
}
|
|
1395
1412
|
}
|
|
1396
1413
|
if (shouldDedupeOutputItemDone(parts, allParts.slice(0, -parts.length))) return;
|
|
1397
|
-
for (const part
|
|
1414
|
+
for (const part of parts) controller.enqueue(part);
|
|
1398
1415
|
},
|
|
1399
1416
|
flush(controller) {
|
|
1417
|
+
if (!useRemoteToolCalling) {
|
|
1418
|
+
const toolCalls = allParts.filter((p) => p.type === "tool-call");
|
|
1419
|
+
const toolResults = allParts.filter((p) => p.type === "tool-result");
|
|
1420
|
+
for (const toolCall of toolCalls) {
|
|
1421
|
+
if (toolCall.providerMetadata?.databricks?.type === MCP_APPROVAL_REQUEST_TYPE) continue;
|
|
1422
|
+
if (!toolResults.some((r) => r.toolCallId === toolCall.toolCallId)) controller.enqueue({
|
|
1423
|
+
...toolCall,
|
|
1424
|
+
providerExecuted: true,
|
|
1425
|
+
dynamic: true
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1400
1429
|
controller.enqueue({
|
|
1401
1430
|
type: "finish",
|
|
1402
1431
|
finishReason,
|
|
@@ -1420,7 +1449,7 @@ var DatabricksResponsesAgentLanguageModel = class {
|
|
|
1420
1449
|
const { args: callArgs, warnings } = callOptionsToResponsesArgs(options);
|
|
1421
1450
|
return {
|
|
1422
1451
|
url: config.url({ path: "/responses" }),
|
|
1423
|
-
headers: (0,
|
|
1452
|
+
headers: (0, _ai_sdk_provider_utils.combineHeaders)(config.headers(), options.headers),
|
|
1424
1453
|
body: {
|
|
1425
1454
|
model: modelId,
|
|
1426
1455
|
input,
|
|
@@ -1449,8 +1478,7 @@ function shouldDedupeOutputItemDone(incomingParts, previousParts) {
|
|
|
1449
1478
|
* corresponds to a specific message and we should only compare against text streamed for that message.
|
|
1450
1479
|
*/
|
|
1451
1480
|
const lastDoneIndex = previousParts.findLastIndex((part) => part.type === "text-delta" && part.providerMetadata?.databricks?.itemType === "response.output_item.done");
|
|
1452
|
-
const
|
|
1453
|
-
const { texts: reconstructuredTexts, current } = partsAfterLastDone.reduce((acc, part) => {
|
|
1481
|
+
const { texts: reconstructuredTexts, current } = previousParts.slice(lastDoneIndex + 1).reduce((acc, part) => {
|
|
1454
1482
|
if (part.type === "text-delta") return {
|
|
1455
1483
|
...acc,
|
|
1456
1484
|
current: acc.current + part.delta
|
|
@@ -1464,9 +1492,9 @@ function shouldDedupeOutputItemDone(incomingParts, previousParts) {
|
|
|
1464
1492
|
texts: [],
|
|
1465
1493
|
current: ""
|
|
1466
1494
|
});
|
|
1467
|
-
reconstructuredTexts.push(current);
|
|
1495
|
+
if (current.length > 0) reconstructuredTexts.push(current);
|
|
1468
1496
|
if (reconstructuredTexts.length === 0) return false;
|
|
1469
|
-
|
|
1497
|
+
return reconstructuredTexts.reduce((acc, text) => {
|
|
1470
1498
|
if (!acc.found) return acc;
|
|
1471
1499
|
const index = doneTextDelta.delta.indexOf(text, acc.lastIndex);
|
|
1472
1500
|
if (index === -1) return {
|
|
@@ -1480,8 +1508,7 @@ function shouldDedupeOutputItemDone(incomingParts, previousParts) {
|
|
|
1480
1508
|
}, {
|
|
1481
1509
|
found: true,
|
|
1482
1510
|
lastIndex: 0
|
|
1483
|
-
});
|
|
1484
|
-
return allTextsFoundInOrder.found;
|
|
1511
|
+
}).found;
|
|
1485
1512
|
}
|
|
1486
1513
|
|
|
1487
1514
|
//#endregion
|
|
@@ -1615,12 +1642,12 @@ const convertFmapiChunkToMessagePart = (chunk, toolCallIdsByIndex) => {
|
|
|
1615
1642
|
} else if (Array.isArray(choice.delta.content)) parts.push(...mapContentItemsToStreamParts(choice.delta.content, chunk.id));
|
|
1616
1643
|
return parts;
|
|
1617
1644
|
};
|
|
1618
|
-
const convertFmapiResponseToMessagePart = (response) => {
|
|
1645
|
+
const convertFmapiResponseToMessagePart = (response, options = { useRemoteToolCalling: false }) => {
|
|
1619
1646
|
const parts = [];
|
|
1620
1647
|
if (response.choices.length === 0) return parts;
|
|
1621
1648
|
const choice = response.choices[0];
|
|
1622
1649
|
if (choice.message.tool_calls && choice.message.tool_calls.length > 0) {
|
|
1623
|
-
for (const toolCall of choice.message.tool_calls) parts.push(convertToolCallToContent(toolCall));
|
|
1650
|
+
for (const toolCall of choice.message.tool_calls) parts.push(convertToolCallToContent(toolCall, options));
|
|
1624
1651
|
if (typeof choice.message.content === "string" && choice.message.content) parts.push({
|
|
1625
1652
|
type: "text",
|
|
1626
1653
|
text: choice.message.content
|
|
@@ -1634,13 +1661,16 @@ const convertFmapiResponseToMessagePart = (response) => {
|
|
|
1634
1661
|
else parts.push(...mapContentItemsToProviderContent(choice.message.content ?? []));
|
|
1635
1662
|
return parts;
|
|
1636
1663
|
};
|
|
1637
|
-
const convertToolCallToContent = (toolCall) => {
|
|
1664
|
+
const convertToolCallToContent = (toolCall, options) => {
|
|
1638
1665
|
return {
|
|
1639
1666
|
type: "tool-call",
|
|
1640
1667
|
toolCallId: toolCall.id,
|
|
1641
|
-
toolName:
|
|
1668
|
+
toolName: toolCall.function.name,
|
|
1642
1669
|
input: toolCall.function.arguments,
|
|
1643
|
-
|
|
1670
|
+
...options.useRemoteToolCalling && {
|
|
1671
|
+
dynamic: true,
|
|
1672
|
+
providerExecuted: true
|
|
1673
|
+
}
|
|
1644
1674
|
};
|
|
1645
1675
|
};
|
|
1646
1676
|
const mapContentItemsToStreamParts = (items, id) => {
|
|
@@ -1654,14 +1684,13 @@ const mapContentItemsToStreamParts = (items, id) => {
|
|
|
1654
1684
|
});
|
|
1655
1685
|
break;
|
|
1656
1686
|
case "image": break;
|
|
1657
|
-
case "reasoning":
|
|
1687
|
+
case "reasoning":
|
|
1658
1688
|
for (const summary of item.summary.filter((s) => s.type === "summary_text")) parts.push({
|
|
1659
1689
|
type: "reasoning-delta",
|
|
1660
1690
|
id,
|
|
1661
1691
|
delta: summary.text
|
|
1662
1692
|
});
|
|
1663
1693
|
break;
|
|
1664
|
-
}
|
|
1665
1694
|
}
|
|
1666
1695
|
return parts;
|
|
1667
1696
|
};
|
|
@@ -1675,13 +1704,12 @@ const mapContentItemsToProviderContent = (items) => {
|
|
|
1675
1704
|
});
|
|
1676
1705
|
break;
|
|
1677
1706
|
case "image": break;
|
|
1678
|
-
case "reasoning":
|
|
1707
|
+
case "reasoning":
|
|
1679
1708
|
for (const summary of item.summary.filter((s) => s.type === "summary_text")) parts.push({
|
|
1680
1709
|
type: "reasoning",
|
|
1681
1710
|
text: summary.text
|
|
1682
1711
|
});
|
|
1683
1712
|
break;
|
|
1684
|
-
}
|
|
1685
1713
|
}
|
|
1686
1714
|
return parts;
|
|
1687
1715
|
};
|
|
@@ -1817,31 +1845,45 @@ const convertToolResultOutputToContentValue = (output) => {
|
|
|
1817
1845
|
};
|
|
1818
1846
|
const ProviderOptionsSchema = zod_v4.z.object({ toolName: zod_v4.z.string().nullish() });
|
|
1819
1847
|
const getToolNameFromPart = async (part) => {
|
|
1820
|
-
|
|
1848
|
+
return (await (0, _ai_sdk_provider_utils.parseProviderOptions)({
|
|
1821
1849
|
provider: "databricks",
|
|
1822
1850
|
providerOptions: part.providerOptions,
|
|
1823
1851
|
schema: ProviderOptionsSchema
|
|
1824
|
-
});
|
|
1825
|
-
return providerOptions?.toolName ?? part.toolName;
|
|
1852
|
+
}))?.toolName ?? part.toolName;
|
|
1826
1853
|
};
|
|
1827
1854
|
|
|
1828
1855
|
//#endregion
|
|
1829
1856
|
//#region src/fmapi-language-model/fmapi-finish-reason.ts
|
|
1830
1857
|
function mapFmapiFinishReason(finishReason) {
|
|
1831
1858
|
switch (finishReason) {
|
|
1832
|
-
case "stop": return
|
|
1833
|
-
|
|
1834
|
-
|
|
1859
|
+
case "stop": return {
|
|
1860
|
+
raw: finishReason,
|
|
1861
|
+
unified: "stop"
|
|
1862
|
+
};
|
|
1863
|
+
case "length": return {
|
|
1864
|
+
raw: finishReason,
|
|
1865
|
+
unified: "length"
|
|
1866
|
+
};
|
|
1867
|
+
case "content_filter": return {
|
|
1868
|
+
raw: finishReason,
|
|
1869
|
+
unified: "content-filter"
|
|
1870
|
+
};
|
|
1835
1871
|
case "function_call":
|
|
1836
|
-
case "tool_calls": return
|
|
1837
|
-
|
|
1872
|
+
case "tool_calls": return {
|
|
1873
|
+
raw: finishReason,
|
|
1874
|
+
unified: "tool-calls"
|
|
1875
|
+
};
|
|
1876
|
+
default: return {
|
|
1877
|
+
raw: finishReason ?? void 0,
|
|
1878
|
+
unified: "other"
|
|
1879
|
+
};
|
|
1838
1880
|
}
|
|
1839
1881
|
}
|
|
1840
1882
|
|
|
1841
1883
|
//#endregion
|
|
1842
1884
|
//#region src/fmapi-language-model/call-options-to-fmapi-args.ts
|
|
1843
1885
|
/**
|
|
1844
|
-
* Converts AI SDK
|
|
1886
|
+
* Converts AI SDK LanguageModelV3CallOptions to Databricks FMAPI body parameters.
|
|
1845
1887
|
*
|
|
1846
1888
|
* Inspired by the getArgs method in:
|
|
1847
1889
|
* https://github.com/vercel/ai/blob/main/packages/openai/src/chat/openai-chat-language-model.ts#L71
|
|
@@ -1853,18 +1895,18 @@ function callOptionsToFmapiArgs(options) {
|
|
|
1853
1895
|
const warnings = [];
|
|
1854
1896
|
const databricksOptions = options.providerOptions?.databricks;
|
|
1855
1897
|
if (options.presencePenalty != null) warnings.push({
|
|
1856
|
-
type: "unsupported
|
|
1857
|
-
|
|
1898
|
+
type: "unsupported",
|
|
1899
|
+
feature: "presencePenalty",
|
|
1858
1900
|
details: "presencePenalty is not supported by the Databricks FMAPI"
|
|
1859
1901
|
});
|
|
1860
1902
|
if (options.frequencyPenalty != null) warnings.push({
|
|
1861
|
-
type: "unsupported
|
|
1862
|
-
|
|
1903
|
+
type: "unsupported",
|
|
1904
|
+
feature: "frequencyPenalty",
|
|
1863
1905
|
details: "frequencyPenalty is not supported by the Databricks FMAPI"
|
|
1864
1906
|
});
|
|
1865
1907
|
if (options.seed != null) warnings.push({
|
|
1866
|
-
type: "unsupported
|
|
1867
|
-
|
|
1908
|
+
type: "unsupported",
|
|
1909
|
+
feature: "seed",
|
|
1868
1910
|
details: "seed is not supported by the Databricks FMAPI"
|
|
1869
1911
|
});
|
|
1870
1912
|
const args = {};
|
|
@@ -1904,7 +1946,7 @@ function callOptionsToFmapiArgs(options) {
|
|
|
1904
1946
|
//#endregion
|
|
1905
1947
|
//#region src/fmapi-language-model/fmapi-language-model.ts
|
|
1906
1948
|
var DatabricksFmapiLanguageModel = class {
|
|
1907
|
-
specificationVersion = "
|
|
1949
|
+
specificationVersion = "v3";
|
|
1908
1950
|
modelId;
|
|
1909
1951
|
config;
|
|
1910
1952
|
constructor(modelId, config) {
|
|
@@ -1916,16 +1958,16 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
1916
1958
|
}
|
|
1917
1959
|
supportedUrls = {};
|
|
1918
1960
|
async doGenerate(options) {
|
|
1919
|
-
const { warnings
|
|
1961
|
+
const { warnings, ...networkArgs } = await this.getArgs({
|
|
1920
1962
|
config: this.config,
|
|
1921
1963
|
options,
|
|
1922
1964
|
stream: false,
|
|
1923
1965
|
modelId: this.modelId
|
|
1924
1966
|
});
|
|
1925
|
-
const { value: response } = await (0,
|
|
1967
|
+
const { value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
1926
1968
|
...networkArgs,
|
|
1927
|
-
successfulResponseHandler: (0,
|
|
1928
|
-
failedResponseHandler: (0,
|
|
1969
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createJsonResponseHandler)(fmapiResponseSchema),
|
|
1970
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
1929
1971
|
errorSchema: zod_v4.z.any(),
|
|
1930
1972
|
errorToMessage: (error) => JSON.stringify(error),
|
|
1931
1973
|
isRetryable: () => false
|
|
@@ -1934,42 +1976,62 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
1934
1976
|
const choice = response.choices[0];
|
|
1935
1977
|
const finishReason = mapFmapiFinishReason(choice?.finish_reason);
|
|
1936
1978
|
return {
|
|
1937
|
-
content: convertFmapiResponseToMessagePart(response),
|
|
1979
|
+
content: convertFmapiResponseToMessagePart(response, { useRemoteToolCalling: this.config.useRemoteToolCalling ?? false }),
|
|
1938
1980
|
finishReason,
|
|
1939
1981
|
usage: {
|
|
1940
|
-
inputTokens:
|
|
1941
|
-
|
|
1942
|
-
|
|
1982
|
+
inputTokens: {
|
|
1983
|
+
total: response.usage?.prompt_tokens ?? 0,
|
|
1984
|
+
noCache: 0,
|
|
1985
|
+
cacheRead: 0,
|
|
1986
|
+
cacheWrite: 0
|
|
1987
|
+
},
|
|
1988
|
+
outputTokens: {
|
|
1989
|
+
total: response.usage?.completion_tokens ?? 0,
|
|
1990
|
+
text: 0,
|
|
1991
|
+
reasoning: 0
|
|
1992
|
+
}
|
|
1943
1993
|
},
|
|
1944
1994
|
warnings
|
|
1945
1995
|
};
|
|
1946
1996
|
}
|
|
1947
1997
|
async doStream(options) {
|
|
1948
|
-
const { warnings
|
|
1998
|
+
const { warnings, ...networkArgs } = await this.getArgs({
|
|
1949
1999
|
config: this.config,
|
|
1950
2000
|
options,
|
|
1951
2001
|
stream: true,
|
|
1952
2002
|
modelId: this.modelId
|
|
1953
2003
|
});
|
|
1954
|
-
const { responseHeaders, value: response } = await (0,
|
|
2004
|
+
const { responseHeaders, value: response } = await (0, _ai_sdk_provider_utils.postJsonToApi)({
|
|
1955
2005
|
...networkArgs,
|
|
1956
|
-
failedResponseHandler: (0,
|
|
2006
|
+
failedResponseHandler: (0, _ai_sdk_provider_utils.createJsonErrorResponseHandler)({
|
|
1957
2007
|
errorSchema: zod_v4.z.any(),
|
|
1958
2008
|
errorToMessage: (error) => JSON.stringify(error),
|
|
1959
2009
|
isRetryable: () => false
|
|
1960
2010
|
}),
|
|
1961
|
-
successfulResponseHandler: (0,
|
|
2011
|
+
successfulResponseHandler: (0, _ai_sdk_provider_utils.createEventSourceResponseHandler)(fmapiChunkSchema),
|
|
1962
2012
|
abortSignal: options.abortSignal
|
|
1963
2013
|
});
|
|
1964
|
-
let finishReason =
|
|
2014
|
+
let finishReason = {
|
|
2015
|
+
raw: void 0,
|
|
2016
|
+
unified: "other"
|
|
2017
|
+
};
|
|
1965
2018
|
let usage = {
|
|
1966
|
-
inputTokens:
|
|
1967
|
-
|
|
1968
|
-
|
|
2019
|
+
inputTokens: {
|
|
2020
|
+
total: 0,
|
|
2021
|
+
noCache: 0,
|
|
2022
|
+
cacheRead: 0,
|
|
2023
|
+
cacheWrite: 0
|
|
2024
|
+
},
|
|
2025
|
+
outputTokens: {
|
|
2026
|
+
total: 0,
|
|
2027
|
+
text: 0,
|
|
2028
|
+
reasoning: 0
|
|
2029
|
+
}
|
|
1969
2030
|
};
|
|
1970
|
-
const toolCallIdsByIndex = new Map();
|
|
1971
|
-
const toolCallNamesById = new Map();
|
|
1972
|
-
const toolCallInputsById = new Map();
|
|
2031
|
+
const toolCallIdsByIndex = /* @__PURE__ */ new Map();
|
|
2032
|
+
const toolCallNamesById = /* @__PURE__ */ new Map();
|
|
2033
|
+
const toolCallInputsById = /* @__PURE__ */ new Map();
|
|
2034
|
+
const useRemoteToolCalling = this.config.useRemoteToolCalling ?? false;
|
|
1973
2035
|
return {
|
|
1974
2036
|
stream: response.pipeThrough(new TransformStream({
|
|
1975
2037
|
start(controller) {
|
|
@@ -1984,7 +2046,10 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
1984
2046
|
rawValue: chunk.rawValue
|
|
1985
2047
|
});
|
|
1986
2048
|
if (!chunk.success) {
|
|
1987
|
-
finishReason =
|
|
2049
|
+
finishReason = {
|
|
2050
|
+
raw: void 0,
|
|
2051
|
+
unified: "error"
|
|
2052
|
+
};
|
|
1988
2053
|
controller.enqueue({
|
|
1989
2054
|
type: "error",
|
|
1990
2055
|
error: chunk.error
|
|
@@ -1994,9 +2059,17 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
1994
2059
|
const choice = chunk.value.choices[0];
|
|
1995
2060
|
finishReason = mapFmapiFinishReason(choice?.finish_reason);
|
|
1996
2061
|
if (chunk.value.usage) usage = {
|
|
1997
|
-
inputTokens:
|
|
1998
|
-
|
|
1999
|
-
|
|
2062
|
+
inputTokens: {
|
|
2063
|
+
total: chunk.value.usage.prompt_tokens ?? 0,
|
|
2064
|
+
noCache: 0,
|
|
2065
|
+
cacheRead: 0,
|
|
2066
|
+
cacheWrite: 0
|
|
2067
|
+
},
|
|
2068
|
+
outputTokens: {
|
|
2069
|
+
total: chunk.value.usage.completion_tokens ?? 0,
|
|
2070
|
+
text: 0,
|
|
2071
|
+
reasoning: 0
|
|
2072
|
+
}
|
|
2000
2073
|
};
|
|
2001
2074
|
const parts = convertFmapiChunkToMessagePart(chunk.value, toolCallIdsByIndex);
|
|
2002
2075
|
for (const part of parts) {
|
|
@@ -2021,9 +2094,12 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
2021
2094
|
controller.enqueue({
|
|
2022
2095
|
type: "tool-call",
|
|
2023
2096
|
toolCallId,
|
|
2024
|
-
toolName
|
|
2097
|
+
toolName,
|
|
2025
2098
|
input: inputText,
|
|
2026
|
-
|
|
2099
|
+
...useRemoteToolCalling && {
|
|
2100
|
+
dynamic: true,
|
|
2101
|
+
providerExecuted: true
|
|
2102
|
+
}
|
|
2027
2103
|
});
|
|
2028
2104
|
}
|
|
2029
2105
|
}
|
|
@@ -2045,7 +2121,7 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
2045
2121
|
const { args: callArgs, warnings } = callOptionsToFmapiArgs(options);
|
|
2046
2122
|
return {
|
|
2047
2123
|
url: config.url({ path: "/chat/completions" }),
|
|
2048
|
-
headers: (0,
|
|
2124
|
+
headers: (0, _ai_sdk_provider_utils.combineHeaders)(config.headers(), options.headers),
|
|
2049
2125
|
body: {
|
|
2050
2126
|
messages,
|
|
2051
2127
|
stream,
|
|
@@ -2063,7 +2139,7 @@ var DatabricksFmapiLanguageModel = class {
|
|
|
2063
2139
|
* Convert AI SDK tool to OpenAI format
|
|
2064
2140
|
*/
|
|
2065
2141
|
function convertToolToOpenAIFormat(tool) {
|
|
2066
|
-
if (tool.type === "provider
|
|
2142
|
+
if (tool.type === "provider") return;
|
|
2067
2143
|
return {
|
|
2068
2144
|
type: "function",
|
|
2069
2145
|
function: {
|
|
@@ -2090,8 +2166,8 @@ function convertToolChoiceToOpenAIFormat(toolChoice) {
|
|
|
2090
2166
|
//#endregion
|
|
2091
2167
|
//#region src/databricks-provider.ts
|
|
2092
2168
|
const createDatabricksProvider = (settings) => {
|
|
2093
|
-
const baseUrl = (0,
|
|
2094
|
-
const getHeaders = () => (0,
|
|
2169
|
+
const baseUrl = (0, _ai_sdk_provider_utils.withoutTrailingSlash)(settings.baseURL);
|
|
2170
|
+
const getHeaders = () => (0, _ai_sdk_provider_utils.combineHeaders)(settings.headers);
|
|
2095
2171
|
const fetch = settings.fetch;
|
|
2096
2172
|
const provider = settings.provider ?? "databricks";
|
|
2097
2173
|
const formatUrl = ({ path }) => settings.formatUrl?.({
|
|
@@ -2108,13 +2184,15 @@ const createDatabricksProvider = (settings) => {
|
|
|
2108
2184
|
url: formatUrl,
|
|
2109
2185
|
headers: getHeaders,
|
|
2110
2186
|
fetch,
|
|
2111
|
-
provider
|
|
2187
|
+
provider,
|
|
2188
|
+
useRemoteToolCalling: settings.useRemoteToolCalling
|
|
2112
2189
|
});
|
|
2113
2190
|
const createFmapi = (modelId) => new DatabricksFmapiLanguageModel(modelId, {
|
|
2114
2191
|
url: formatUrl,
|
|
2115
2192
|
headers: getHeaders,
|
|
2116
2193
|
fetch,
|
|
2117
|
-
provider
|
|
2194
|
+
provider,
|
|
2195
|
+
useRemoteToolCalling: settings.useRemoteToolCalling
|
|
2118
2196
|
});
|
|
2119
2197
|
const notImplemented = (name) => {
|
|
2120
2198
|
return () => {
|
|
@@ -2122,28 +2200,28 @@ const createDatabricksProvider = (settings) => {
|
|
|
2122
2200
|
};
|
|
2123
2201
|
};
|
|
2124
2202
|
return {
|
|
2203
|
+
specificationVersion: "v3",
|
|
2125
2204
|
responses: createResponsesAgent,
|
|
2126
2205
|
chatCompletions: createFmapi,
|
|
2127
2206
|
chatAgent: createChatAgent,
|
|
2128
2207
|
imageModel: notImplemented("ImageModel"),
|
|
2129
2208
|
textEmbeddingModel: notImplemented("TextEmbeddingModel"),
|
|
2209
|
+
embeddingModel: notImplemented("EmbeddingModel"),
|
|
2130
2210
|
languageModel: notImplemented("LanguageModel")
|
|
2131
2211
|
};
|
|
2132
2212
|
};
|
|
2133
2213
|
|
|
2134
2214
|
//#endregion
|
|
2135
|
-
exports.
|
|
2136
|
-
exports.
|
|
2137
|
-
exports.
|
|
2138
|
-
exports.
|
|
2139
|
-
exports.
|
|
2140
|
-
exports.
|
|
2141
|
-
exports.
|
|
2142
|
-
exports.
|
|
2143
|
-
exports.
|
|
2144
|
-
exports.
|
|
2145
|
-
exports.
|
|
2146
|
-
exports.
|
|
2147
|
-
exports.isMcpApprovalRequest = isMcpApprovalRequest
|
|
2148
|
-
exports.isMcpApprovalResponse = isMcpApprovalResponse
|
|
2215
|
+
exports.MCP_APPROVAL_REQUEST_TYPE = MCP_APPROVAL_REQUEST_TYPE;
|
|
2216
|
+
exports.MCP_APPROVAL_RESPONSE_TYPE = MCP_APPROVAL_RESPONSE_TYPE;
|
|
2217
|
+
exports.MCP_APPROVAL_STATUS_KEY = MCP_APPROVAL_STATUS_KEY;
|
|
2218
|
+
exports.createApprovalStatusOutput = createApprovalStatusOutput;
|
|
2219
|
+
exports.createDatabricksProvider = createDatabricksProvider;
|
|
2220
|
+
exports.extractApprovalStatus = extractApprovalStatus;
|
|
2221
|
+
exports.extractApprovalStatusFromToolResult = extractApprovalStatusFromToolResult;
|
|
2222
|
+
exports.extractDatabricksMetadata = extractDatabricksMetadata;
|
|
2223
|
+
exports.getMcpApprovalState = getMcpApprovalState;
|
|
2224
|
+
exports.isApprovalStatusOutput = isApprovalStatusOutput;
|
|
2225
|
+
exports.isMcpApprovalRequest = isMcpApprovalRequest;
|
|
2226
|
+
exports.isMcpApprovalResponse = isMcpApprovalResponse;
|
|
2149
2227
|
//# sourceMappingURL=index.cjs.map
|