@jerome-benoit/sap-ai-provider 4.6.3 → 4.6.5
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/dist/{chunk-7ZKPZONG.js → chunk-DVRCVX3D.js} +24 -17
- package/dist/{chunk-7ZKPZONG.js.map → chunk-DVRCVX3D.js.map} +1 -1
- package/dist/{chunk-5FHTB5RT.js → chunk-IW3HT2O2.js} +3 -3
- package/dist/{chunk-WLW2XIIX.js → chunk-MUVZG52Z.js} +2 -2
- package/dist/{chunk-RHZV73MM.js → chunk-RIDFTJHB.js} +3 -3
- package/dist/{foundation-models-embedding-model-strategy-FHJ3PW42.js → foundation-models-embedding-model-strategy-LVCLPX77.js} +4 -4
- package/dist/{foundation-models-language-model-strategy-XQ24PJK4.js → foundation-models-language-model-strategy-PZMQYE3T.js} +4 -4
- package/dist/index.cjs +23 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{orchestration-embedding-model-strategy-FKAUQZH2.js → orchestration-embedding-model-strategy-SJ6AR4CA.js} +4 -4
- package/dist/{orchestration-language-model-strategy-TSZQCLG3.js → orchestration-language-model-strategy-B36B6QYQ.js} +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-5FHTB5RT.js.map → chunk-IW3HT2O2.js.map} +0 -0
- /package/dist/{chunk-WLW2XIIX.js.map → chunk-MUVZG52Z.js.map} +0 -0
- /package/dist/{chunk-RHZV73MM.js.map → chunk-RIDFTJHB.js.map} +0 -0
- /package/dist/{foundation-models-embedding-model-strategy-FHJ3PW42.js.map → foundation-models-embedding-model-strategy-LVCLPX77.js.map} +0 -0
- /package/dist/{foundation-models-language-model-strategy-XQ24PJK4.js.map → foundation-models-language-model-strategy-PZMQYE3T.js.map} +0 -0
- /package/dist/{orchestration-embedding-model-strategy-FKAUQZH2.js.map → orchestration-embedding-model-strategy-SJ6AR4CA.js.map} +0 -0
- /package/dist/{orchestration-language-model-strategy-TSZQCLG3.js.map → orchestration-language-model-strategy-B36B6QYQ.js.map} +0 -0
|
@@ -2,12 +2,12 @@ import {createRequire as __createRequire} from 'module';var require=__createRequ
|
|
|
2
2
|
import {
|
|
3
3
|
buildEmbeddingResult,
|
|
4
4
|
prepareEmbeddingCall
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MUVZG52Z.js";
|
|
6
6
|
import {
|
|
7
7
|
VERSION,
|
|
8
8
|
convertToAISDKError,
|
|
9
9
|
deepMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DVRCVX3D.js";
|
|
11
11
|
|
|
12
12
|
// src/base-embedding-model-strategy.ts
|
|
13
13
|
var BaseEmbeddingModelStrategy = class {
|
|
@@ -58,4 +58,4 @@ var BaseEmbeddingModelStrategy = class {
|
|
|
58
58
|
export {
|
|
59
59
|
BaseEmbeddingModelStrategy
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-IW3HT2O2.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getProviderName,
|
|
5
5
|
sapAIEmbeddingProviderOptions,
|
|
6
6
|
validateModelParamsWithWarnings
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DVRCVX3D.js";
|
|
8
8
|
|
|
9
9
|
// src/strategy-utils.ts
|
|
10
10
|
import { TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
@@ -682,4 +682,4 @@ export {
|
|
|
682
682
|
normalizeEmbedding,
|
|
683
683
|
prepareEmbeddingCall
|
|
684
684
|
};
|
|
685
|
-
//# sourceMappingURL=chunk-
|
|
685
|
+
//# sourceMappingURL=chunk-MUVZG52Z.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
createAISDKRequestBodySummary,
|
|
10
10
|
createStreamTransformer,
|
|
11
11
|
mapToolChoice
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MUVZG52Z.js";
|
|
13
13
|
import {
|
|
14
14
|
VERSION,
|
|
15
15
|
convertToAISDKError,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isPrefillError,
|
|
18
18
|
normalizeHeaders,
|
|
19
19
|
sapAILanguageModelProviderOptions
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DVRCVX3D.js";
|
|
21
21
|
|
|
22
22
|
// src/base-language-model-strategy.ts
|
|
23
23
|
import { parseProviderOptions } from "@ai-sdk/provider-utils";
|
|
@@ -232,4 +232,4 @@ var BaseLanguageModelStrategy = class {
|
|
|
232
232
|
export {
|
|
233
233
|
BaseLanguageModelStrategy
|
|
234
234
|
};
|
|
235
|
-
//# sourceMappingURL=chunk-
|
|
235
|
+
//# sourceMappingURL=chunk-RIDFTJHB.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseEmbeddingModelStrategy
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IW3HT2O2.js";
|
|
5
5
|
import {
|
|
6
6
|
buildModelDeployment,
|
|
7
7
|
hasKeys,
|
|
8
8
|
normalizeEmbedding
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-MUVZG52Z.js";
|
|
10
|
+
import "./chunk-DVRCVX3D.js";
|
|
11
11
|
|
|
12
12
|
// src/foundation-models-embedding-model-strategy.ts
|
|
13
13
|
var FoundationModelsEmbeddingModelStrategy = class extends BaseEmbeddingModelStrategy {
|
|
@@ -51,4 +51,4 @@ var FoundationModelsEmbeddingModelStrategy = class extends BaseEmbeddingModelStr
|
|
|
51
51
|
export {
|
|
52
52
|
FoundationModelsEmbeddingModelStrategy
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=foundation-models-embedding-model-strategy-
|
|
54
|
+
//# sourceMappingURL=foundation-models-embedding-model-strategy-LVCLPX77.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseLanguageModelStrategy
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RIDFTJHB.js";
|
|
5
5
|
import "./chunk-IIBSUXGT.js";
|
|
6
6
|
import {
|
|
7
7
|
buildModelDeployment,
|
|
8
8
|
convertResponseFormat,
|
|
9
9
|
convertToolsToSAPFormat
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MUVZG52Z.js";
|
|
11
11
|
import {
|
|
12
12
|
normalizeHeaders
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DVRCVX3D.js";
|
|
14
14
|
|
|
15
15
|
// src/foundation-models-language-model-strategy.ts
|
|
16
16
|
var FOUNDATION_MODELS_PARAM_MAPPINGS = [
|
|
@@ -89,4 +89,4 @@ var FoundationModelsLanguageModelStrategy = class extends BaseLanguageModelStrat
|
|
|
89
89
|
export {
|
|
90
90
|
FoundationModelsLanguageModelStrategy
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=foundation-models-language-model-strategy-
|
|
92
|
+
//# sourceMappingURL=foundation-models-language-model-strategy-PZMQYE3T.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -30102,7 +30102,7 @@ var require_dist = __commonJS({
|
|
|
30102
30102
|
// src/sap-ai-error.ts
|
|
30103
30103
|
function convertSAPErrorToAPICallError(errorResponse, context) {
|
|
30104
30104
|
const { code, location, message, requestId } = extractErrorFields(errorResponse);
|
|
30105
|
-
const statusCode = getStatusCodeFromSAPError(code);
|
|
30105
|
+
const statusCode = getStatusCodeFromSAPError(code, context?.httpStatusCode);
|
|
30106
30106
|
const responseBody = JSON.stringify({
|
|
30107
30107
|
error: {
|
|
30108
30108
|
code,
|
|
@@ -30163,10 +30163,11 @@ function convertToAISDKError(error, context) {
|
|
|
30163
30163
|
return error;
|
|
30164
30164
|
}
|
|
30165
30165
|
const rootError = getRootError(error);
|
|
30166
|
-
const errorResponse =
|
|
30166
|
+
const errorResponse = findStructuredErrorResponse(error);
|
|
30167
30167
|
if (errorResponse) {
|
|
30168
30168
|
return convertSAPErrorToAPICallError(errorResponse, {
|
|
30169
30169
|
...context,
|
|
30170
|
+
httpStatusCode: getAxiosError(error)?.response?.status,
|
|
30170
30171
|
responseHeaders: context?.responseHeaders ?? getAxiosResponseHeaders(error)
|
|
30171
30172
|
});
|
|
30172
30173
|
}
|
|
@@ -30323,7 +30324,7 @@ function extractModelIdentifier(message, location) {
|
|
|
30323
30324
|
return void 0;
|
|
30324
30325
|
}
|
|
30325
30326
|
function extractSAPErrorMessage(error) {
|
|
30326
|
-
const errorResponse =
|
|
30327
|
+
const errorResponse = findStructuredErrorResponse(error);
|
|
30327
30328
|
if (errorResponse) {
|
|
30328
30329
|
return extractErrorFields(errorResponse).message;
|
|
30329
30330
|
}
|
|
@@ -30333,14 +30334,18 @@ function extractSAPErrorMessage(error) {
|
|
|
30333
30334
|
}
|
|
30334
30335
|
return typeof rootError === "string" ? rootError : void 0;
|
|
30335
30336
|
}
|
|
30336
|
-
function
|
|
30337
|
+
function findStructuredErrorResponse(error) {
|
|
30337
30338
|
const rootError = getRootError(error);
|
|
30338
|
-
if (
|
|
30339
|
+
if (isStructuredErrorResponse(rootError)) {
|
|
30339
30340
|
return rootError;
|
|
30340
30341
|
}
|
|
30342
|
+
const axiosData = getAxiosError(error)?.response?.data;
|
|
30343
|
+
if (axiosData && isStructuredErrorResponse(axiosData)) {
|
|
30344
|
+
return axiosData;
|
|
30345
|
+
}
|
|
30341
30346
|
if (rootError instanceof Error) {
|
|
30342
30347
|
const parsed = tryExtractSAPErrorFromMessage(rootError.message);
|
|
30343
|
-
if (parsed &&
|
|
30348
|
+
if (parsed && isStructuredErrorResponse(parsed)) {
|
|
30344
30349
|
return parsed;
|
|
30345
30350
|
}
|
|
30346
30351
|
}
|
|
@@ -30367,11 +30372,13 @@ function getAxiosResponseHeaders(error) {
|
|
|
30367
30372
|
function getRootError(error) {
|
|
30368
30373
|
return error instanceof Error && (0, import_util.isErrorWithCause)(error) ? error.rootCause : error;
|
|
30369
30374
|
}
|
|
30370
|
-
function getStatusCodeFromSAPError(code) {
|
|
30371
|
-
if (
|
|
30372
|
-
if (code >= 100 && code < 600) {
|
|
30375
|
+
function getStatusCodeFromSAPError(code, httpStatusCode) {
|
|
30376
|
+
if (code && code >= 100 && code < 600) {
|
|
30373
30377
|
return code;
|
|
30374
30378
|
}
|
|
30379
|
+
if (httpStatusCode && httpStatusCode >= 100 && httpStatusCode < 600) {
|
|
30380
|
+
return httpStatusCode;
|
|
30381
|
+
}
|
|
30375
30382
|
return HTTP_STATUS.INTERNAL_ERROR;
|
|
30376
30383
|
}
|
|
30377
30384
|
function isAbortError(error) {
|
|
@@ -30383,7 +30390,10 @@ function isAbortError(error) {
|
|
|
30383
30390
|
}
|
|
30384
30391
|
return false;
|
|
30385
30392
|
}
|
|
30386
|
-
function
|
|
30393
|
+
function isRetryable(statusCode) {
|
|
30394
|
+
return statusCode === HTTP_STATUS.REQUEST_TIMEOUT || statusCode === HTTP_STATUS.CONFLICT || statusCode === HTTP_STATUS.RATE_LIMIT || statusCode >= HTTP_STATUS.INTERNAL_ERROR && statusCode < 600;
|
|
30395
|
+
}
|
|
30396
|
+
function isStructuredErrorResponse(error) {
|
|
30387
30397
|
if (error === null || typeof error !== "object" || !("error" in error)) {
|
|
30388
30398
|
return false;
|
|
30389
30399
|
}
|
|
@@ -30399,7 +30409,7 @@ function isOrchestrationErrorResponse(error) {
|
|
|
30399
30409
|
if (typeof errorEntry.message !== "string") {
|
|
30400
30410
|
return false;
|
|
30401
30411
|
}
|
|
30402
|
-
if ("code" in entry && typeof errorEntry.code !== "number") {
|
|
30412
|
+
if ("code" in entry && errorEntry.code != null && typeof errorEntry.code !== "number") {
|
|
30403
30413
|
return false;
|
|
30404
30414
|
}
|
|
30405
30415
|
return true;
|
|
@@ -30412,14 +30422,11 @@ function isOrchestrationErrorResponse(error) {
|
|
|
30412
30422
|
if (typeof errorObj.message !== "string") {
|
|
30413
30423
|
return false;
|
|
30414
30424
|
}
|
|
30415
|
-
if ("code" in innerError && typeof errorObj.code !== "number") {
|
|
30425
|
+
if ("code" in innerError && errorObj.code != null && typeof errorObj.code !== "number") {
|
|
30416
30426
|
return false;
|
|
30417
30427
|
}
|
|
30418
30428
|
return true;
|
|
30419
30429
|
}
|
|
30420
|
-
function isRetryable(statusCode) {
|
|
30421
|
-
return statusCode === HTTP_STATUS.REQUEST_TIMEOUT || statusCode === HTTP_STATUS.CONFLICT || statusCode === HTTP_STATUS.RATE_LIMIT || statusCode >= HTTP_STATUS.INTERNAL_ERROR && statusCode < 600;
|
|
30422
|
-
}
|
|
30423
30430
|
function serializeAxiosResponseData(data, maxLength = 2e3) {
|
|
30424
30431
|
if (data === void 0) return void 0;
|
|
30425
30432
|
let serialized;
|
|
@@ -31294,7 +31301,7 @@ var VERSION;
|
|
|
31294
31301
|
var init_version = __esm({
|
|
31295
31302
|
"src/version.ts"() {
|
|
31296
31303
|
"use strict";
|
|
31297
|
-
VERSION = true ? "4.6.
|
|
31304
|
+
VERSION = true ? "4.6.5" : "0.0.0-test";
|
|
31298
31305
|
}
|
|
31299
31306
|
});
|
|
31300
31307
|
|