@jerome-benoit/sap-ai-provider-v2 4.2.4 → 4.2.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/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -27465,7 +27465,7 @@ var require_axios = __commonJS({
|
|
|
27465
27465
|
}
|
|
27466
27466
|
return requestedURL;
|
|
27467
27467
|
}
|
|
27468
|
-
var
|
|
27468
|
+
var VERSION2 = "1.13.2";
|
|
27469
27469
|
function parseProtocol(url2) {
|
|
27470
27470
|
const match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
|
|
27471
27471
|
return match2 && match2[1] || "";
|
|
@@ -28194,7 +28194,7 @@ var require_axios = __commonJS({
|
|
|
28194
28194
|
));
|
|
28195
28195
|
}
|
|
28196
28196
|
const headers = AxiosHeaders$1.from(config.headers).normalize();
|
|
28197
|
-
headers.set("User-Agent", "axios/" +
|
|
28197
|
+
headers.set("User-Agent", "axios/" + VERSION2, false);
|
|
28198
28198
|
const { onUploadProgress, onDownloadProgress } = config;
|
|
28199
28199
|
const maxRate = config.maxRate;
|
|
28200
28200
|
let maxUploadRate = void 0;
|
|
@@ -28204,7 +28204,7 @@ var require_axios = __commonJS({
|
|
|
28204
28204
|
data = formDataToStream$1(data, (formHeaders) => {
|
|
28205
28205
|
headers.set(formHeaders);
|
|
28206
28206
|
}, {
|
|
28207
|
-
tag: `axios-${
|
|
28207
|
+
tag: `axios-${VERSION2}-boundary`,
|
|
28208
28208
|
boundary: userBoundary && userBoundary[1] || void 0
|
|
28209
28209
|
});
|
|
28210
28210
|
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
@@ -29241,7 +29241,7 @@ var require_axios = __commonJS({
|
|
|
29241
29241
|
var deprecatedWarnings = {};
|
|
29242
29242
|
validators$1.transitional = function transitional(validator2, version2, message) {
|
|
29243
29243
|
function formatMessage(opt, desc) {
|
|
29244
|
-
return "[Axios v" +
|
|
29244
|
+
return "[Axios v" + VERSION2 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
29245
29245
|
}
|
|
29246
29246
|
return (value, opt, opts) => {
|
|
29247
29247
|
if (validator2 === false) {
|
|
@@ -29658,7 +29658,7 @@ var require_axios = __commonJS({
|
|
|
29658
29658
|
axios.CanceledError = CanceledError;
|
|
29659
29659
|
axios.CancelToken = CancelToken$1;
|
|
29660
29660
|
axios.isCancel = isCancel;
|
|
29661
|
-
axios.VERSION =
|
|
29661
|
+
axios.VERSION = VERSION2;
|
|
29662
29662
|
axios.toFormData = toFormData;
|
|
29663
29663
|
axios.AxiosError = AxiosError;
|
|
29664
29664
|
axios.Cancel = axios.CanceledError;
|
|
@@ -29739,12 +29739,15 @@ var index_exports = {};
|
|
|
29739
29739
|
__export(index_exports, {
|
|
29740
29740
|
OrchestrationClient: () => import_orchestration5.OrchestrationClient,
|
|
29741
29741
|
OrchestrationEmbeddingClient: () => import_orchestration5.OrchestrationEmbeddingClient,
|
|
29742
|
+
OrchestrationEmbeddingResponse: () => import_orchestration4.OrchestrationEmbeddingResponse,
|
|
29742
29743
|
OrchestrationResponse: () => import_orchestration4.OrchestrationResponse,
|
|
29744
|
+
OrchestrationStream: () => import_orchestration4.OrchestrationStream,
|
|
29743
29745
|
OrchestrationStreamChunkResponse: () => import_orchestration4.OrchestrationStreamChunkResponse,
|
|
29744
29746
|
OrchestrationStreamResponse: () => import_orchestration4.OrchestrationStreamResponse,
|
|
29745
29747
|
SAPAIEmbeddingModel: () => SAPAIEmbeddingModelV2,
|
|
29746
29748
|
SAPAILanguageModel: () => SAPAILanguageModelV2,
|
|
29747
29749
|
SAP_AI_PROVIDER_NAME: () => SAP_AI_PROVIDER_NAME,
|
|
29750
|
+
VERSION: () => VERSION,
|
|
29748
29751
|
buildAzureContentSafetyFilter: () => import_orchestration3.buildAzureContentSafetyFilter,
|
|
29749
29752
|
buildDocumentGroundingConfig: () => import_orchestration3.buildDocumentGroundingConfig,
|
|
29750
29753
|
buildDpiMaskingProvider: () => import_orchestration3.buildDpiMaskingProvider,
|
|
@@ -29917,10 +29920,14 @@ function convertSAPErrorToAPICallError(errorResponse, context) {
|
|
|
29917
29920
|
let requestId;
|
|
29918
29921
|
if (Array.isArray(error)) {
|
|
29919
29922
|
const firstError = error[0];
|
|
29920
|
-
|
|
29921
|
-
|
|
29922
|
-
|
|
29923
|
-
|
|
29923
|
+
if (firstError) {
|
|
29924
|
+
message = firstError.message;
|
|
29925
|
+
code = firstError.code;
|
|
29926
|
+
location = firstError.location;
|
|
29927
|
+
requestId = firstError.request_id;
|
|
29928
|
+
} else {
|
|
29929
|
+
message = "Unknown SAP AI error";
|
|
29930
|
+
}
|
|
29924
29931
|
} else {
|
|
29925
29932
|
message = error.message;
|
|
29926
29933
|
code = error.code;
|
|
@@ -30063,7 +30070,7 @@ The model's response was blocked by content safety filters. Try a different prom
|
|
|
30063
30070
|
);
|
|
30064
30071
|
}
|
|
30065
30072
|
const statusMatch = /status code (\d+)/i.exec(originalErrorMsg);
|
|
30066
|
-
if (statusMatch) {
|
|
30073
|
+
if (statusMatch?.[1]) {
|
|
30067
30074
|
const extractedStatus = Number.parseInt(statusMatch[1], 10);
|
|
30068
30075
|
return createAPICallError(
|
|
30069
30076
|
error,
|
|
@@ -30757,8 +30764,9 @@ function convertToSAPMessages(prompt, options = {}) {
|
|
|
30757
30764
|
}
|
|
30758
30765
|
}
|
|
30759
30766
|
}
|
|
30760
|
-
const
|
|
30761
|
-
|
|
30767
|
+
const firstPart = contentParts[0];
|
|
30768
|
+
const userMessage = contentParts.length === 1 && firstPart?.type === "text" ? {
|
|
30769
|
+
content: firstPart.text ?? "",
|
|
30762
30770
|
role: "user"
|
|
30763
30771
|
} : {
|
|
30764
30772
|
content: contentParts,
|
|
@@ -31671,18 +31679,24 @@ var sapai = createSAPAIProvider();
|
|
|
31671
31679
|
var import_orchestration3 = require("@sap-ai-sdk/orchestration");
|
|
31672
31680
|
var import_orchestration4 = require("@sap-ai-sdk/orchestration");
|
|
31673
31681
|
|
|
31682
|
+
// src/version.ts
|
|
31683
|
+
var VERSION = true ? "4.2.5" : "0.0.0-test";
|
|
31684
|
+
|
|
31674
31685
|
// src/index.ts
|
|
31675
31686
|
var import_orchestration5 = require("@sap-ai-sdk/orchestration");
|
|
31676
31687
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31677
31688
|
0 && (module.exports = {
|
|
31678
31689
|
OrchestrationClient,
|
|
31679
31690
|
OrchestrationEmbeddingClient,
|
|
31691
|
+
OrchestrationEmbeddingResponse,
|
|
31680
31692
|
OrchestrationResponse,
|
|
31693
|
+
OrchestrationStream,
|
|
31681
31694
|
OrchestrationStreamChunkResponse,
|
|
31682
31695
|
OrchestrationStreamResponse,
|
|
31683
31696
|
SAPAIEmbeddingModel,
|
|
31684
31697
|
SAPAILanguageModel,
|
|
31685
31698
|
SAP_AI_PROVIDER_NAME,
|
|
31699
|
+
VERSION,
|
|
31686
31700
|
buildAzureContentSafetyFilter,
|
|
31687
31701
|
buildDocumentGroundingConfig,
|
|
31688
31702
|
buildDpiMaskingProvider,
|