@databricks/ai-sdk-provider 0.2.2 → 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 +457 -244
- 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} +418 -179
- 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.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV3, ProviderV3 } from "@ai-sdk/provider";
|
|
2
2
|
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
3
|
-
import { z } from "zod/v4";
|
|
4
3
|
|
|
5
4
|
//#region src/databricks-provider.d.ts
|
|
6
5
|
type DatabricksLanguageModelConfig = {
|
|
@@ -10,13 +9,22 @@ type DatabricksLanguageModelConfig = {
|
|
|
10
9
|
path: string;
|
|
11
10
|
}) => string;
|
|
12
11
|
fetch?: FetchFunction;
|
|
12
|
+
/**
|
|
13
|
+
* When true, marks all tool calls as dynamic and provider-executed.
|
|
14
|
+
* This indicates that tool execution is handled remotely by Databricks agents.
|
|
15
|
+
* Defaults to true.
|
|
16
|
+
*/
|
|
17
|
+
useRemoteToolCalling?: boolean;
|
|
13
18
|
};
|
|
14
|
-
interface DatabricksProvider extends
|
|
19
|
+
interface DatabricksProvider extends ProviderV3 {
|
|
15
20
|
/** Agents */
|
|
16
|
-
chatAgent(modelId: string):
|
|
17
|
-
responses(modelId: string):
|
|
21
|
+
chatAgent(modelId: string): LanguageModelV3;
|
|
22
|
+
responses(modelId: string): LanguageModelV3;
|
|
18
23
|
/** Foundation Models */
|
|
19
|
-
chatCompletions(modelId: string):
|
|
24
|
+
chatCompletions(modelId: string): LanguageModelV3;
|
|
25
|
+
/** Required overrides from ProviderV3 */
|
|
26
|
+
textEmbeddingModel(modelId: string): never;
|
|
27
|
+
languageModel(modelId: string): never;
|
|
20
28
|
}
|
|
21
29
|
interface DatabricksProviderSettings {
|
|
22
30
|
/** Base URL for the Databricks API calls. */
|
|
@@ -37,32 +45,16 @@ interface DatabricksProviderSettings {
|
|
|
37
45
|
baseUrl?: string;
|
|
38
46
|
path: string;
|
|
39
47
|
}) => string;
|
|
48
|
+
/**
|
|
49
|
+
* When true, marks all tool calls as dynamic and provider-executed.
|
|
50
|
+
* This indicates that tool execution is handled remotely by Databricks agents.
|
|
51
|
+
* Defaults to true.
|
|
52
|
+
*/
|
|
53
|
+
useRemoteToolCalling?: boolean;
|
|
40
54
|
}
|
|
41
|
-
declare const createDatabricksProvider: (settings: DatabricksProviderSettings) => DatabricksProvider;
|
|
42
|
-
//#region src/tools.d.ts
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=databricks-provider.d.ts.map
|
|
45
|
-
declare const DATABRICKS_TOOL_CALL_ID = "databricks-tool-call";
|
|
46
|
-
/**
|
|
47
|
-
* The AI-SDK requires that tools used by the model are defined ahead of time.
|
|
48
|
-
*
|
|
49
|
-
* Since tool calls can be orchestrated by Databricks' agents we don't know the name, input, or output schemas
|
|
50
|
-
* of the tools until the model is called.
|
|
51
|
-
*
|
|
52
|
-
* In the DatabricksProvider we transform all tool calls to fit this definition, and keep the
|
|
53
|
-
* original name as part of the metadata. This allows us to parse any tool orchestrated by Databricks' agents,
|
|
54
|
-
* 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.
|
|
55
|
-
*/
|
|
56
|
-
declare const DATABRICKS_TOOL_DEFINITION: {
|
|
57
|
-
name: string;
|
|
58
|
-
description: string;
|
|
59
|
-
inputSchema: z.ZodAny;
|
|
60
|
-
outputSchema: z.ZodAny;
|
|
61
|
-
};
|
|
62
|
-
|
|
55
|
+
declare const createDatabricksProvider: (settings: DatabricksProviderSettings) => DatabricksProvider;
|
|
63
56
|
//#endregion
|
|
64
57
|
//#region src/mcp.d.ts
|
|
65
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
66
58
|
/**
|
|
67
59
|
* MCP Approval Utility Functions
|
|
68
60
|
*
|
|
@@ -173,9 +165,6 @@ declare function createApprovalStatusOutput(approve: boolean): ApprovalStatusOut
|
|
|
173
165
|
* // 'awaiting-approval' | 'approved' | 'denied'
|
|
174
166
|
*/
|
|
175
167
|
declare function getMcpApprovalState(output: unknown): McpApprovalState;
|
|
176
|
-
|
|
177
168
|
//#endregion
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
export { ApprovalStatusOutput, DATABRICKS_TOOL_CALL_ID, DATABRICKS_TOOL_DEFINITION, DatabricksLanguageModelConfig, DatabricksProvider, DatabricksProviderSettings, DatabricksToolMetadata, MCP_APPROVAL_REQUEST_TYPE, MCP_APPROVAL_RESPONSE_TYPE, MCP_APPROVAL_STATUS_KEY, McpApprovalState, createApprovalStatusOutput, createDatabricksProvider, extractApprovalStatus, extractApprovalStatusFromToolResult, extractDatabricksMetadata, getMcpApprovalState, isApprovalStatusOutput, isMcpApprovalRequest, isMcpApprovalResponse };
|
|
169
|
+
export { ApprovalStatusOutput, DatabricksLanguageModelConfig, DatabricksProvider, DatabricksProviderSettings, DatabricksToolMetadata, MCP_APPROVAL_REQUEST_TYPE, MCP_APPROVAL_RESPONSE_TYPE, MCP_APPROVAL_STATUS_KEY, McpApprovalState, createApprovalStatusOutput, createDatabricksProvider, extractApprovalStatus, extractApprovalStatusFromToolResult, extractDatabricksMetadata, getMcpApprovalState, isApprovalStatusOutput, isMcpApprovalRequest, isMcpApprovalResponse };
|
|
181
170
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/databricks-provider.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/datab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A;;;;AA1GtC;;;;iBAwHgB,mCAAA,CAAoC,MAAA;EAClD,IAAA;EACA,KAAA;AAAA;;;AAhHF;;;;;AAKA;;iBAwIgB,0BAAA,CAA2B,OAAA,YAAmB,oBAAA;;;AArI9D;;;;;;;;;;;iBA0JgB,mBAAA,CAAoB,MAAA,YAAkB,gBAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FetchFunction } from "@ai-sdk/provider-utils";
|
|
2
|
-
import {
|
|
3
|
-
import { LanguageModelV2, ProviderV2 } from "@ai-sdk/provider";
|
|
2
|
+
import { LanguageModelV3, ProviderV3 } from "@ai-sdk/provider";
|
|
4
3
|
|
|
5
4
|
//#region src/databricks-provider.d.ts
|
|
6
5
|
type DatabricksLanguageModelConfig = {
|
|
@@ -10,13 +9,22 @@ type DatabricksLanguageModelConfig = {
|
|
|
10
9
|
path: string;
|
|
11
10
|
}) => string;
|
|
12
11
|
fetch?: FetchFunction;
|
|
12
|
+
/**
|
|
13
|
+
* When true, marks all tool calls as dynamic and provider-executed.
|
|
14
|
+
* This indicates that tool execution is handled remotely by Databricks agents.
|
|
15
|
+
* Defaults to true.
|
|
16
|
+
*/
|
|
17
|
+
useRemoteToolCalling?: boolean;
|
|
13
18
|
};
|
|
14
|
-
interface DatabricksProvider extends
|
|
19
|
+
interface DatabricksProvider extends ProviderV3 {
|
|
15
20
|
/** Agents */
|
|
16
|
-
chatAgent(modelId: string):
|
|
17
|
-
responses(modelId: string):
|
|
21
|
+
chatAgent(modelId: string): LanguageModelV3;
|
|
22
|
+
responses(modelId: string): LanguageModelV3;
|
|
18
23
|
/** Foundation Models */
|
|
19
|
-
chatCompletions(modelId: string):
|
|
24
|
+
chatCompletions(modelId: string): LanguageModelV3;
|
|
25
|
+
/** Required overrides from ProviderV3 */
|
|
26
|
+
textEmbeddingModel(modelId: string): never;
|
|
27
|
+
languageModel(modelId: string): never;
|
|
20
28
|
}
|
|
21
29
|
interface DatabricksProviderSettings {
|
|
22
30
|
/** Base URL for the Databricks API calls. */
|
|
@@ -37,32 +45,16 @@ interface DatabricksProviderSettings {
|
|
|
37
45
|
baseUrl?: string;
|
|
38
46
|
path: string;
|
|
39
47
|
}) => string;
|
|
48
|
+
/**
|
|
49
|
+
* When true, marks all tool calls as dynamic and provider-executed.
|
|
50
|
+
* This indicates that tool execution is handled remotely by Databricks agents.
|
|
51
|
+
* Defaults to true.
|
|
52
|
+
*/
|
|
53
|
+
useRemoteToolCalling?: boolean;
|
|
40
54
|
}
|
|
41
|
-
declare const createDatabricksProvider: (settings: DatabricksProviderSettings) => DatabricksProvider;
|
|
42
|
-
//#region src/tools.d.ts
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=databricks-provider.d.ts.map
|
|
45
|
-
declare const DATABRICKS_TOOL_CALL_ID = "databricks-tool-call";
|
|
46
|
-
/**
|
|
47
|
-
* The AI-SDK requires that tools used by the model are defined ahead of time.
|
|
48
|
-
*
|
|
49
|
-
* Since tool calls can be orchestrated by Databricks' agents we don't know the name, input, or output schemas
|
|
50
|
-
* of the tools until the model is called.
|
|
51
|
-
*
|
|
52
|
-
* In the DatabricksProvider we transform all tool calls to fit this definition, and keep the
|
|
53
|
-
* original name as part of the metadata. This allows us to parse any tool orchestrated by Databricks' agents,
|
|
54
|
-
* 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.
|
|
55
|
-
*/
|
|
56
|
-
declare const DATABRICKS_TOOL_DEFINITION: {
|
|
57
|
-
name: string;
|
|
58
|
-
description: string;
|
|
59
|
-
inputSchema: z.ZodAny;
|
|
60
|
-
outputSchema: z.ZodAny;
|
|
61
|
-
};
|
|
62
|
-
|
|
55
|
+
declare const createDatabricksProvider: (settings: DatabricksProviderSettings) => DatabricksProvider;
|
|
63
56
|
//#endregion
|
|
64
57
|
//#region src/mcp.d.ts
|
|
65
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
66
58
|
/**
|
|
67
59
|
* MCP Approval Utility Functions
|
|
68
60
|
*
|
|
@@ -173,9 +165,6 @@ declare function createApprovalStatusOutput(approve: boolean): ApprovalStatusOut
|
|
|
173
165
|
* // 'awaiting-approval' | 'approved' | 'denied'
|
|
174
166
|
*/
|
|
175
167
|
declare function getMcpApprovalState(output: unknown): McpApprovalState;
|
|
176
|
-
|
|
177
168
|
//#endregion
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
export { ApprovalStatusOutput, DATABRICKS_TOOL_CALL_ID, DATABRICKS_TOOL_DEFINITION, DatabricksLanguageModelConfig, DatabricksProvider, DatabricksProviderSettings, DatabricksToolMetadata, MCP_APPROVAL_REQUEST_TYPE, MCP_APPROVAL_RESPONSE_TYPE, MCP_APPROVAL_STATUS_KEY, McpApprovalState, createApprovalStatusOutput, createDatabricksProvider, extractApprovalStatus, extractApprovalStatusFromToolResult, extractDatabricksMetadata, getMcpApprovalState, isApprovalStatusOutput, isMcpApprovalRequest, isMcpApprovalResponse };
|
|
181
|
-
//# sourceMappingURL=index.d.ts.map
|
|
169
|
+
export { ApprovalStatusOutput, DatabricksLanguageModelConfig, DatabricksProvider, DatabricksProviderSettings, DatabricksToolMetadata, MCP_APPROVAL_REQUEST_TYPE, MCP_APPROVAL_RESPONSE_TYPE, MCP_APPROVAL_STATUS_KEY, McpApprovalState, createApprovalStatusOutput, createDatabricksProvider, extractApprovalStatus, extractApprovalStatusFromToolResult, extractDatabricksMetadata, getMcpApprovalState, isApprovalStatusOutput, isMcpApprovalRequest, isMcpApprovalResponse };
|
|
170
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/databricks-provider.ts","../src/mcp.ts"],"mappings":";;;;KAMY,6BAAA;EACV,QAAA;EACA,OAAA,QAAe,MAAA;EACf,GAAA,GAAM,OAAA;IAAW,IAAA;EAAA;EACjB,KAAA,GAAQ,aAAA;EAFR;;;;;EAQA,oBAAA;AAAA;AAAA,UAGe,kBAAA,SAA2B,UAAA;EAHtB;EA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