@jerome-benoit/sap-ai-provider-v2 4.1.2 → 4.1.3
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 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -40
- package/dist/index.d.ts +65 -40
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30399,6 +30399,7 @@ var SAPAIEmbeddingModel = class {
|
|
|
30399
30399
|
* the SAP AI SDK's OrchestrationEmbeddingClient.
|
|
30400
30400
|
* @param options - The embedding request options
|
|
30401
30401
|
* @returns Promise resolving to embeddings and usage information
|
|
30402
|
+
* @since 1.0.0
|
|
30402
30403
|
* @example
|
|
30403
30404
|
* ```typescript
|
|
30404
30405
|
* const result = await model.doEmbed({
|
|
@@ -30541,6 +30542,7 @@ var SAPAIEmbeddingModelV2 = class {
|
|
|
30541
30542
|
* @param options.providerOptions - Optional provider-specific options
|
|
30542
30543
|
* @param options.headers - Optional HTTP headers
|
|
30543
30544
|
* @returns Promise resolving to embeddings and metadata in V2 format
|
|
30545
|
+
* @since 1.0.0
|
|
30544
30546
|
*/
|
|
30545
30547
|
async doEmbed(options) {
|
|
30546
30548
|
const v3Options = {
|
|
@@ -30581,6 +30583,9 @@ function castProviderMetadataV3ToV2(v3Metadata) {
|
|
|
30581
30583
|
return v3Metadata;
|
|
30582
30584
|
}
|
|
30583
30585
|
|
|
30586
|
+
// src/sap-ai-provider-v2.ts
|
|
30587
|
+
var import_provider4 = require("@ai-sdk/provider");
|
|
30588
|
+
|
|
30584
30589
|
// src/sap-ai-language-model.ts
|
|
30585
30590
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
30586
30591
|
var import_orchestration2 = require("@sap-ai-sdk/orchestration");
|
|
@@ -31462,21 +31467,26 @@ var SAPAILanguageModel = class {
|
|
|
31462
31467
|
type: "unsupported"
|
|
31463
31468
|
});
|
|
31464
31469
|
}
|
|
31470
|
+
let responseFormat;
|
|
31465
31471
|
if (options.responseFormat?.type === "json") {
|
|
31472
|
+
responseFormat = options.responseFormat.schema ? {
|
|
31473
|
+
json_schema: {
|
|
31474
|
+
description: options.responseFormat.description,
|
|
31475
|
+
name: options.responseFormat.name ?? "response",
|
|
31476
|
+
schema: options.responseFormat.schema,
|
|
31477
|
+
strict: null
|
|
31478
|
+
},
|
|
31479
|
+
type: "json_schema"
|
|
31480
|
+
} : { type: "json_object" };
|
|
31481
|
+
} else if (this.settings.responseFormat) {
|
|
31482
|
+
responseFormat = this.settings.responseFormat;
|
|
31483
|
+
}
|
|
31484
|
+
if (responseFormat && responseFormat.type !== "text") {
|
|
31466
31485
|
warnings.push({
|
|
31467
31486
|
message: "responseFormat JSON mode is forwarded to the underlying model; support and schema adherence depend on the model/deployment.",
|
|
31468
31487
|
type: "other"
|
|
31469
31488
|
});
|
|
31470
31489
|
}
|
|
31471
|
-
const responseFormat = options.responseFormat?.type === "json" ? options.responseFormat.schema ? {
|
|
31472
|
-
json_schema: {
|
|
31473
|
-
description: options.responseFormat.description,
|
|
31474
|
-
name: options.responseFormat.name ?? "response",
|
|
31475
|
-
schema: options.responseFormat.schema,
|
|
31476
|
-
strict: null
|
|
31477
|
-
},
|
|
31478
|
-
type: "json_schema"
|
|
31479
|
-
} : { type: "json_object" } : void 0;
|
|
31480
31490
|
const orchestrationConfig = {
|
|
31481
31491
|
promptTemplating: {
|
|
31482
31492
|
model: {
|
|
@@ -31802,6 +31812,13 @@ function createSAPAIProvider(options = {}) {
|
|
|
31802
31812
|
provider.chat = createModel;
|
|
31803
31813
|
provider.embedding = createEmbeddingModel;
|
|
31804
31814
|
provider.textEmbeddingModel = createEmbeddingModel;
|
|
31815
|
+
provider.imageModel = (modelId) => {
|
|
31816
|
+
throw new import_provider4.NoSuchModelError({
|
|
31817
|
+
message: `SAP AI Core Orchestration Service does not support image generation. Model '${modelId}' is not available.`,
|
|
31818
|
+
modelId,
|
|
31819
|
+
modelType: "imageModel"
|
|
31820
|
+
});
|
|
31821
|
+
};
|
|
31805
31822
|
return provider;
|
|
31806
31823
|
}
|
|
31807
31824
|
var sapai = createSAPAIProvider();
|