@jerome-benoit/sap-ai-provider 4.4.11 → 4.4.12
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 +27 -1
- package/dist/{chunk-MAA5SA36.js → chunk-DSKMFLFE.js} +3 -3
- package/dist/{chunk-MS24Z5GC.js → chunk-V6CDF624.js} +2 -2
- package/dist/{chunk-ZSLBPQMF.js → chunk-YROP2PPZ.js} +2 -2
- package/dist/{foundation-models-embedding-model-strategy-5OBV2NXK.js → foundation-models-embedding-model-strategy-4VOC2JHJ.js} +3 -3
- package/dist/{foundation-models-language-model-strategy-NZIOTQMU.js → foundation-models-language-model-strategy-2Y7BCOCU.js} +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/{orchestration-embedding-model-strategy-V7VRMOKK.js → orchestration-embedding-model-strategy-P27ZDK62.js} +3 -3
- package/dist/{orchestration-language-model-strategy-B2KKMHLT.js → orchestration-language-model-strategy-2CWJSR42.js} +4 -4
- package/package.json +21 -17
- /package/dist/{chunk-MAA5SA36.js.map → chunk-DSKMFLFE.js.map} +0 -0
- /package/dist/{chunk-MS24Z5GC.js.map → chunk-V6CDF624.js.map} +0 -0
- /package/dist/{chunk-ZSLBPQMF.js.map → chunk-YROP2PPZ.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-5OBV2NXK.js.map → foundation-models-embedding-model-strategy-4VOC2JHJ.js.map} +0 -0
- /package/dist/{foundation-models-language-model-strategy-NZIOTQMU.js.map → foundation-models-language-model-strategy-2Y7BCOCU.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-V7VRMOKK.js.map → orchestration-embedding-model-strategy-P27ZDK62.js.map} +0 -0
- /package/dist/{orchestration-language-model-strategy-B2KKMHLT.js.map → orchestration-language-model-strategy-2CWJSR42.js.map} +0 -0
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ SAP's enterprise-grade AI models through the familiar Vercel AI SDK interface.
|
|
|
19
19
|
- [Installation](#installation)
|
|
20
20
|
- [Provider Creation](#provider-creation)
|
|
21
21
|
- [Option 1: Factory Function (Recommended for Custom Configuration)](#option-1-factory-function-recommended-for-custom-configuration)
|
|
22
|
+
- [API Selection](#api-selection)
|
|
22
23
|
- [Option 2: Default Instance (Quick Start)](#option-2-default-instance-quick-start)
|
|
23
24
|
- [Authentication](#authentication)
|
|
24
25
|
- [Basic Usage](#basic-usage)
|
|
@@ -129,7 +130,7 @@ try {
|
|
|
129
130
|
|
|
130
131
|
## Installation
|
|
131
132
|
|
|
132
|
-
**Requirements:** Node.js 20+ and Vercel AI SDK 5.0+
|
|
133
|
+
**Requirements:** Node.js 20+ and Vercel AI SDK 5.0+ (6.0+ recommended)
|
|
133
134
|
|
|
134
135
|
```bash
|
|
135
136
|
npm install @jerome-benoit/sap-ai-provider ai
|
|
@@ -145,6 +146,31 @@ yarn add @jerome-benoit/sap-ai-provider ai
|
|
|
145
146
|
pnpm add @jerome-benoit/sap-ai-provider ai
|
|
146
147
|
```
|
|
147
148
|
|
|
149
|
+
> **V2 Facade Package Available:** For users requiring `LanguageModelV2`/`EmbeddingModelV2` interfaces, install the dedicated V2 facade package:
|
|
150
|
+
>
|
|
151
|
+
> ```bash
|
|
152
|
+
> npm install @jerome-benoit/sap-ai-provider-v2 ai
|
|
153
|
+
> ```
|
|
154
|
+
>
|
|
155
|
+
> This package provides a V2-compatible facade over the internal V3 implementation.
|
|
156
|
+
>
|
|
157
|
+
> Basic Usage Example:
|
|
158
|
+
>
|
|
159
|
+
> ```typescript
|
|
160
|
+
> import { createSAPAIProvider } from "@jerome-benoit/sap-ai-provider-v2";
|
|
161
|
+
> import { generateText } from "ai";
|
|
162
|
+
>
|
|
163
|
+
> const provider = createSAPAIProvider();
|
|
164
|
+
> const result = await generateText({
|
|
165
|
+
> model: provider("gpt-4.1"),
|
|
166
|
+
> prompt: "Hello V2!",
|
|
167
|
+
> });
|
|
168
|
+
> console.log(result.text);
|
|
169
|
+
> ```
|
|
170
|
+
>
|
|
171
|
+
> For a detailed understanding of the dual-package architecture, refer to
|
|
172
|
+
> [Architecture - Dual-Package](./ARCHITECTURE.md#dual-package-architecture-v3--v2).
|
|
173
|
+
|
|
148
174
|
## Provider Creation
|
|
149
175
|
|
|
150
176
|
You can create an SAP AI provider in two ways:
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
createAISDKRequestBodySummary,
|
|
9
9
|
createStreamTransformer,
|
|
10
10
|
mapToolChoice
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YROP2PPZ.js";
|
|
12
12
|
import {
|
|
13
13
|
VERSION,
|
|
14
14
|
convertToAISDKError,
|
|
15
15
|
getProviderName,
|
|
16
16
|
normalizeHeaders,
|
|
17
17
|
sapAILanguageModelProviderOptions
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-V6CDF624.js";
|
|
19
19
|
|
|
20
20
|
// src/base-language-model-strategy.ts
|
|
21
21
|
import { parseProviderOptions } from "@ai-sdk/provider-utils";
|
|
@@ -180,4 +180,4 @@ var BaseLanguageModelStrategy = class {
|
|
|
180
180
|
export {
|
|
181
181
|
BaseLanguageModelStrategy
|
|
182
182
|
};
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-DSKMFLFE.js.map
|
|
@@ -30430,7 +30430,7 @@ function tryExtractSAPErrorFromMessage(message) {
|
|
|
30430
30430
|
}
|
|
30431
30431
|
|
|
30432
30432
|
// src/version.ts
|
|
30433
|
-
var VERSION = true ? "4.4.
|
|
30433
|
+
var VERSION = true ? "4.4.12" : "0.0.0-test";
|
|
30434
30434
|
|
|
30435
30435
|
export {
|
|
30436
30436
|
__toESM,
|
|
@@ -30483,4 +30483,4 @@ mime-types/index.js:
|
|
|
30483
30483
|
axios/dist/node/axios.cjs:
|
|
30484
30484
|
(*! Axios v1.13.5 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
30485
30485
|
*/
|
|
30486
|
-
//# sourceMappingURL=chunk-
|
|
30486
|
+
//# sourceMappingURL=chunk-V6CDF624.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getProviderName,
|
|
4
4
|
sapAIEmbeddingProviderOptions,
|
|
5
5
|
validateModelParamsWithWarnings
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-V6CDF624.js";
|
|
7
7
|
|
|
8
8
|
// src/strategy-utils.ts
|
|
9
9
|
import { TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
@@ -632,4 +632,4 @@ export {
|
|
|
632
632
|
normalizeEmbedding,
|
|
633
633
|
prepareEmbeddingCall
|
|
634
634
|
};
|
|
635
|
-
//# sourceMappingURL=chunk-
|
|
635
|
+
//# sourceMappingURL=chunk-YROP2PPZ.js.map
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
hasKeys,
|
|
5
5
|
normalizeEmbedding,
|
|
6
6
|
prepareEmbeddingCall
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YROP2PPZ.js";
|
|
8
8
|
import {
|
|
9
9
|
VERSION,
|
|
10
10
|
convertToAISDKError,
|
|
11
11
|
deepMerge
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-V6CDF624.js";
|
|
13
13
|
|
|
14
14
|
// src/foundation-models-embedding-model-strategy.ts
|
|
15
15
|
var FoundationModelsEmbeddingModelStrategy = class {
|
|
@@ -65,4 +65,4 @@ var FoundationModelsEmbeddingModelStrategy = class {
|
|
|
65
65
|
export {
|
|
66
66
|
FoundationModelsEmbeddingModelStrategy
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=foundation-models-embedding-model-strategy-
|
|
68
|
+
//# sourceMappingURL=foundation-models-embedding-model-strategy-4VOC2JHJ.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseLanguageModelStrategy
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DSKMFLFE.js";
|
|
4
4
|
import "./chunk-47JZKXQO.js";
|
|
5
5
|
import {
|
|
6
6
|
buildModelDeployment,
|
|
7
7
|
convertResponseFormat,
|
|
8
8
|
convertToolsToSAPFormat
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-YROP2PPZ.js";
|
|
10
|
+
import "./chunk-V6CDF624.js";
|
|
11
11
|
|
|
12
12
|
// src/foundation-models-language-model-strategy.ts
|
|
13
13
|
var FOUNDATION_MODELS_PARAM_MAPPINGS = [
|
|
@@ -83,4 +83,4 @@ var FoundationModelsLanguageModelStrategy = class extends BaseLanguageModelStrat
|
|
|
83
83
|
export {
|
|
84
84
|
FoundationModelsLanguageModelStrategy
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=foundation-models-language-model-strategy-
|
|
86
|
+
//# sourceMappingURL=foundation-models-language-model-strategy-2Y7BCOCU.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -31258,7 +31258,7 @@ var VERSION;
|
|
|
31258
31258
|
var init_version = __esm({
|
|
31259
31259
|
"src/version.ts"() {
|
|
31260
31260
|
"use strict";
|
|
31261
|
-
VERSION = true ? "4.4.
|
|
31261
|
+
VERSION = true ? "4.4.12" : "0.0.0-test";
|
|
31262
31262
|
}
|
|
31263
31263
|
});
|
|
31264
31264
|
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
sapAILanguageModelProviderOptions,
|
|
16
16
|
validateEmbeddingModelParamsSettings,
|
|
17
17
|
validateModelParamsSettings
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-V6CDF624.js";
|
|
19
19
|
|
|
20
20
|
// src/sap-ai-embedding-model.ts
|
|
21
21
|
import { parseProviderOptions } from "@ai-sdk/provider-utils";
|
|
@@ -50,21 +50,21 @@ function getOrCreateLanguageModelStrategy(api) {
|
|
|
50
50
|
async function createEmbeddingModelStrategy(api) {
|
|
51
51
|
if (api === "foundation-models") {
|
|
52
52
|
const { AzureOpenAiEmbeddingClient } = await import("@sap-ai-sdk/foundation-models");
|
|
53
|
-
const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-
|
|
53
|
+
const { FoundationModelsEmbeddingModelStrategy } = await import("./foundation-models-embedding-model-strategy-4VOC2JHJ.js");
|
|
54
54
|
return new FoundationModelsEmbeddingModelStrategy(AzureOpenAiEmbeddingClient);
|
|
55
55
|
}
|
|
56
56
|
const { OrchestrationEmbeddingClient: OrchestrationEmbeddingClient2 } = await import("@sap-ai-sdk/orchestration");
|
|
57
|
-
const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-
|
|
57
|
+
const { OrchestrationEmbeddingModelStrategy } = await import("./orchestration-embedding-model-strategy-P27ZDK62.js");
|
|
58
58
|
return new OrchestrationEmbeddingModelStrategy(OrchestrationEmbeddingClient2);
|
|
59
59
|
}
|
|
60
60
|
async function createLanguageModelStrategy(api) {
|
|
61
61
|
if (api === "foundation-models") {
|
|
62
62
|
const { AzureOpenAiChatClient } = await import("@sap-ai-sdk/foundation-models");
|
|
63
|
-
const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-
|
|
63
|
+
const { FoundationModelsLanguageModelStrategy } = await import("./foundation-models-language-model-strategy-2Y7BCOCU.js");
|
|
64
64
|
return new FoundationModelsLanguageModelStrategy(AzureOpenAiChatClient);
|
|
65
65
|
}
|
|
66
66
|
const { OrchestrationClient: OrchestrationClient2 } = await import("@sap-ai-sdk/orchestration");
|
|
67
|
-
const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-
|
|
67
|
+
const { OrchestrationLanguageModelStrategy } = await import("./orchestration-language-model-strategy-2CWJSR42.js");
|
|
68
68
|
return new OrchestrationLanguageModelStrategy(OrchestrationClient2);
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
hasKeys,
|
|
4
4
|
normalizeEmbedding,
|
|
5
5
|
prepareEmbeddingCall
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YROP2PPZ.js";
|
|
7
7
|
import {
|
|
8
8
|
VERSION,
|
|
9
9
|
convertToAISDKError,
|
|
10
10
|
deepMerge
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-V6CDF624.js";
|
|
12
12
|
|
|
13
13
|
// src/orchestration-embedding-model-strategy.ts
|
|
14
14
|
var OrchestrationEmbeddingModelStrategy = class {
|
|
@@ -75,4 +75,4 @@ var OrchestrationEmbeddingModelStrategy = class {
|
|
|
75
75
|
export {
|
|
76
76
|
OrchestrationEmbeddingModelStrategy
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=orchestration-embedding-model-strategy-
|
|
78
|
+
//# sourceMappingURL=orchestration-embedding-model-strategy-P27ZDK62.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseLanguageModelStrategy
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DSKMFLFE.js";
|
|
4
4
|
import {
|
|
5
5
|
convertToSAPMessages
|
|
6
6
|
} from "./chunk-47JZKXQO.js";
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
convertToolsToSAPFormat,
|
|
11
11
|
hasKeys,
|
|
12
12
|
mapToolChoice
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YROP2PPZ.js";
|
|
14
14
|
import {
|
|
15
15
|
deepMerge,
|
|
16
16
|
getProviderName,
|
|
17
17
|
orchestrationConfigRefSchema,
|
|
18
18
|
sapAILanguageModelProviderOptions
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-V6CDF624.js";
|
|
20
20
|
|
|
21
21
|
// src/orchestration-language-model-strategy.ts
|
|
22
22
|
import { parseProviderOptions } from "@ai-sdk/provider-utils";
|
|
@@ -487,4 +487,4 @@ var OrchestrationLanguageModelStrategy = class extends BaseLanguageModelStrategy
|
|
|
487
487
|
export {
|
|
488
488
|
OrchestrationLanguageModelStrategy
|
|
489
489
|
};
|
|
490
|
-
//# sourceMappingURL=orchestration-language-model-strategy-
|
|
490
|
+
//# sourceMappingURL=orchestration-language-model-strategy-2CWJSR42.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jerome-benoit/sap-ai-provider",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SAP AI Provider for Vercel AI SDK (powered by @sap-ai-sdk/orchestration and @sap-ai-sdk/foundation-models)",
|
|
6
6
|
"keywords": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"author": "jerome-benoit",
|
|
29
29
|
"volta": {
|
|
30
|
-
"node": "24.13.
|
|
30
|
+
"node": "24.13.1"
|
|
31
31
|
},
|
|
32
32
|
"main": "./dist/index.cjs",
|
|
33
33
|
"module": "./dist/index.js",
|
|
@@ -50,42 +50,46 @@
|
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup",
|
|
52
52
|
"build:watch": "tsup --watch",
|
|
53
|
+
"build:v2": "tsup --config tsup.config.v2.ts",
|
|
54
|
+
"build:v2:watch": "tsup --config tsup.config.v2.ts --watch",
|
|
55
|
+
"check-build": "ls -la dist/ && test -f dist/index.js && test -f dist/index.cjs && test -f dist/index.d.ts",
|
|
56
|
+
"check-build:v2": "ls -la dist/ && test -f dist/index-v2.js && test -f dist/index-v2.cjs && test -f dist/index-v2.d.ts",
|
|
53
57
|
"clean": "rm -rf dist",
|
|
54
58
|
"lint": "npm run lint:md:all && eslint .",
|
|
55
59
|
"lint-fix": "npm run lint:md:fix && eslint . --fix",
|
|
56
60
|
"lint:md": "markdownlint -c .markdownlintrc '**/*.md'",
|
|
61
|
+
"lint:md:all": "npm run lint:md && npm run lint:md:toc",
|
|
57
62
|
"lint:md:fix": "markdownlint -c .markdownlintrc '**/*.md' --fix",
|
|
58
63
|
"lint:md:links": "find . -name '*.md' -not -path './node_modules/*' -exec markdown-link-check -c .markdown-link-check.json {} \\;",
|
|
59
64
|
"lint:md:toc": "tsx scripts/check-toc.ts",
|
|
60
|
-
"
|
|
61
|
-
"type-check":
|
|
65
|
+
"prepare:v2": "tsx scripts/prepare-v2-package.ts",
|
|
66
|
+
"prepublishOnly": "npm run type-check && npm run lint && npm run test && npm run build && npm run check-build && node -e \"process.exit(require('fs').existsSync('dist/index-v2.js')?0:1)\" && npm run prepare:v2 || true",
|
|
62
67
|
"prettier-check": "prettier --check .",
|
|
63
68
|
"prettier-fix": "prettier --write .",
|
|
64
69
|
"test": "vitest run",
|
|
65
|
-
"test:
|
|
66
|
-
"test:node": "vitest --config vitest.node.config.ts --run",
|
|
70
|
+
"test:coverage": "vitest run --coverage",
|
|
67
71
|
"test:edge": "vitest --config vitest.edge.config.ts --run",
|
|
72
|
+
"test:node": "vitest --config vitest.node.config.ts --run",
|
|
68
73
|
"test:node:watch": "vitest --config vitest.node.config.ts",
|
|
69
|
-
"test:
|
|
70
|
-
"
|
|
71
|
-
"check-build": "ls -la dist/ && test -f dist/index.js && test -f dist/index.cjs && test -f dist/index.d.ts"
|
|
74
|
+
"test:watch": "vitest",
|
|
75
|
+
"type-check": "tsc --noEmit"
|
|
72
76
|
},
|
|
73
77
|
"dependencies": {
|
|
74
78
|
"@ai-sdk/provider": "^3.0.8",
|
|
75
|
-
"@ai-sdk/provider-utils": "^4.0.
|
|
76
|
-
"@sap-ai-sdk/foundation-models": "^2.
|
|
77
|
-
"@sap-ai-sdk/orchestration": "^2.
|
|
79
|
+
"@ai-sdk/provider-utils": "^4.0.15",
|
|
80
|
+
"@sap-ai-sdk/foundation-models": "^2.7.0",
|
|
81
|
+
"@sap-ai-sdk/orchestration": "^2.7.0",
|
|
78
82
|
"zod": "^4.3.6"
|
|
79
83
|
},
|
|
80
84
|
"devDependencies": {
|
|
81
85
|
"@edge-runtime/vm": "^5.0.0",
|
|
82
86
|
"@eslint/js": "^9.39.2",
|
|
83
|
-
"@types/node": "^25.2.
|
|
87
|
+
"@types/node": "^25.2.3",
|
|
84
88
|
"@vitest/coverage-v8": "^4.0.18",
|
|
85
|
-
"dotenv": "^17.
|
|
89
|
+
"dotenv": "^17.3.1",
|
|
86
90
|
"eslint": "^9.39.2",
|
|
87
|
-
"eslint-plugin-jsdoc": "^62.
|
|
88
|
-
"eslint-plugin-perfectionist": "^5.
|
|
91
|
+
"eslint-plugin-jsdoc": "^62.6.0",
|
|
92
|
+
"eslint-plugin-perfectionist": "^5.6.0",
|
|
89
93
|
"globals": "^17.3.0",
|
|
90
94
|
"markdown-link-check": "^3.14.2",
|
|
91
95
|
"markdownlint-cli": "^0.47.0",
|
|
@@ -93,7 +97,7 @@
|
|
|
93
97
|
"tsup": "^8.5.1",
|
|
94
98
|
"tsx": "^4.21.0",
|
|
95
99
|
"typescript": "^5.9.3",
|
|
96
|
-
"typescript-eslint": "^8.
|
|
100
|
+
"typescript-eslint": "^8.56.0",
|
|
97
101
|
"vitest": "^4.0.18"
|
|
98
102
|
},
|
|
99
103
|
"peerDependencies": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|