@sap-ai-sdk/ai-api 2.5.1-20260126013511.0 → 2.5.1-20260127013423.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/dist/utils/deployment-resolver.d.ts +18 -0
- package/dist/utils/deployment-resolver.d.ts.map +1 -1
- package/dist/utils/deployment-resolver.js +30 -1
- package/dist/utils/deployment-resolver.js.map +1 -1
- package/dist/utils/model.d.ts +8 -0
- package/dist/utils/model.d.ts.map +1 -1
- package/dist/utils/model.js +15 -0
- package/dist/utils/model.js.map +1 -1
- package/package.json +2 -2
|
@@ -76,6 +76,15 @@ export interface DeploymentResolutionOptions {
|
|
|
76
76
|
* @internal
|
|
77
77
|
*/
|
|
78
78
|
export declare function resolveDeployment(opts: DeploymentResolutionOptions): Promise<AiDeployment>;
|
|
79
|
+
/**
|
|
80
|
+
* Type guard to check if the model deployment is a deployment ID config.
|
|
81
|
+
* @param modelDeployment - The model deployment configuration.
|
|
82
|
+
* @returns Whether the model deployment is a deployment ID config.
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
export declare function isDeploymentIdConfig(modelDeployment: ModelDeployment | ResourceGroupConfig): modelDeployment is {
|
|
86
|
+
deploymentId: string;
|
|
87
|
+
};
|
|
79
88
|
/**
|
|
80
89
|
* Query the AI Core service for a deployment that matches the given criteria.
|
|
81
90
|
* If more than one deployment matches the criteria, the first one's ID is returned.
|
|
@@ -98,4 +107,13 @@ export declare function resolveDeploymentUrl(opts: DeploymentResolutionOptions):
|
|
|
98
107
|
* @internal
|
|
99
108
|
*/
|
|
100
109
|
export declare function getAllDeployments(opts: DeploymentResolutionOptions): Promise<AiDeployment[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Get the deployment ID for a foundation model scenario.
|
|
112
|
+
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
113
|
+
* @param executableId - The scenario ID.
|
|
114
|
+
* @param destination - The destination to use for the request.
|
|
115
|
+
* @returns The ID of the deployment, if found.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
export declare function getFoundationModelDeploymentId(modelDeployment: ModelDeployment, executableId: string, destination?: HttpDestinationOrFetchOptions): Promise<string>;
|
|
101
119
|
//# sourceMappingURL=deployment-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/deployment-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,
|
|
1
|
+
{"version":3,"file":"deployment-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/deployment-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,UAAU,GAAG,MAAM;IAC9C;;OAEG;IACH,SAAS,EAAE,UAAU,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,UAAU,GAAG,MAAM,IAC3C,UAAU,GACV,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC,GAAG,mBAAmB,CAAC,CAAC;AAE3E;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,eAAe,GAC/B,MAAM,GAAG,SAAS,CAIpB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,6BAA6B,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,YAAY,CAAC,CAqBvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,eAAe,GAAG,mBAAmB,GACrD,eAAe,IAAI;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAI7C;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAM7B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,YAAY,EAAE,CAAC,CAuBzB;AAED;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CAClD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,6BAA6B,GAC1C,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorWithCause } from '@sap-cloud-sdk/util';
|
|
2
2
|
import { DeploymentApi } from '../client/AI_CORE_API/index.js';
|
|
3
3
|
import { deploymentCache } from './deployment-cache.js';
|
|
4
|
-
import { extractModel } from './model.js';
|
|
4
|
+
import { extractModel, translateToFoundationModel } from './model.js';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
@@ -31,6 +31,15 @@ export async function resolveDeployment(opts) {
|
|
|
31
31
|
}
|
|
32
32
|
return deployments[0];
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if the model deployment is a deployment ID config.
|
|
36
|
+
* @param modelDeployment - The model deployment configuration.
|
|
37
|
+
* @returns Whether the model deployment is a deployment ID config.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export function isDeploymentIdConfig(modelDeployment) {
|
|
41
|
+
return (typeof modelDeployment === 'object' && 'deploymentId' in modelDeployment);
|
|
42
|
+
}
|
|
34
43
|
/**
|
|
35
44
|
* Query the AI Core service for a deployment that matches the given criteria.
|
|
36
45
|
* If more than one deployment matches the criteria, the first one's ID is returned.
|
|
@@ -79,4 +88,24 @@ export async function getAllDeployments(opts) {
|
|
|
79
88
|
throw new ErrorWithCause('Failed to fetch the list of deployments.', error);
|
|
80
89
|
}
|
|
81
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the deployment ID for a foundation model scenario.
|
|
93
|
+
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
94
|
+
* @param executableId - The scenario ID.
|
|
95
|
+
* @param destination - The destination to use for the request.
|
|
96
|
+
* @returns The ID of the deployment, if found.
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
export async function getFoundationModelDeploymentId(modelDeployment, executableId, destination) {
|
|
100
|
+
if (isDeploymentIdConfig(modelDeployment)) {
|
|
101
|
+
return modelDeployment.deploymentId;
|
|
102
|
+
}
|
|
103
|
+
return resolveDeploymentId({
|
|
104
|
+
scenarioId: 'foundation-models',
|
|
105
|
+
executableId,
|
|
106
|
+
model: translateToFoundationModel(modelDeployment),
|
|
107
|
+
resourceGroup: getResourceGroup(modelDeployment),
|
|
108
|
+
destination
|
|
109
|
+
});
|
|
110
|
+
}
|
|
82
111
|
//# sourceMappingURL=deployment-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment-resolver.js","sourceRoot":"","sources":["../../src/utils/deployment-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEL,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"deployment-resolver.js","sourceRoot":"","sources":["../../src/utils/deployment-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEL,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,0BAA0B,EAE3B,MAAM,YAAY,CAAC;AA8CpB;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,eAAgC;IAEhC,OAAO,OAAO,eAAe,KAAK,QAAQ;QACxC,CAAC,CAAC,eAAe,CAAC,aAAa;QAC/B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AA6BD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAiC;IAEjC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,WAAW,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAEhD,IAAI,KAAK,EAAE,CAAC;QACV,WAAW,GAAG,WAAW,CAAC,MAAM,CAC9B,UAAU,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,IAAI,KAAK,KAAK,CAAC,IAAI,CAC5D,CAAC;QACF,IAAI,KA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B,CACrC,IAAiC;IAEjC,MAAM,EACJ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,GAAG,SAAS,EAC1B,GAAG,IAAI,CAAC;IACT,IAAI,CAAC;QACH,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,aAAa,CAAC,eAAe,CACvD;YACE,UAAU;YACV,MAAM,EAAE,SAAS;YACjB,GAAG,CAAC,YAAY,IAAI,EAAE,aAAa,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;SACvD,EACD,EAAE,mBAAmB,EAAE,aAAa,EAAE,CACvC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAEvB,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAExC,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,cAAc,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,eAAgC,EAChC,YAAoB,EACpB,WAA2C;IAE3C,IAAI,oBAAoB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC,YAAY,CAAC;IACtC,CAAC;IAED,OAAO,mBAAmB,CAAC;QACzB,UAAU,EAAE,mBAAmB;QAC/B,YAAY;QACZ,KAAK,EAAE,0BAA0B,CAAC,eAAe,CAAC;QAClD,aAAa,EAAE,gBAAgB,CAAC,eAAe,CAAC;QAChD,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
|
package/dist/utils/model.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModelConfig } from './deployment-resolver.js';
|
|
1
2
|
import type { AiDeployment } from '../client/AI_CORE_API/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* A foundation model is identified by its name and optionally a version.
|
|
@@ -20,4 +21,11 @@ export interface FoundationModel {
|
|
|
20
21
|
* @internal
|
|
21
22
|
*/
|
|
22
23
|
export declare function extractModel(deployment: AiDeployment): FoundationModel | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Translate a model configuration to a foundation model.
|
|
26
|
+
* @param modelConfig - Representation of a model.
|
|
27
|
+
* @returns The model as foundation model.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function translateToFoundationModel(modelConfig: string | ModelConfig): FoundationModel;
|
|
23
31
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,YAAY,GACvB,eAAe,GAAG,SAAS,CAK7B"}
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,YAAY,GACvB,eAAe,GAAG,SAAS,CAK7B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,GAAG,WAAW,GAChC,eAAe,CASjB"}
|
package/dist/utils/model.js
CHANGED
|
@@ -13,4 +13,19 @@ export function extractModel(deployment) {
|
|
|
13
13
|
return model;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Translate a model configuration to a foundation model.
|
|
18
|
+
* @param modelConfig - Representation of a model.
|
|
19
|
+
* @returns The model as foundation model.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export function translateToFoundationModel(modelConfig) {
|
|
23
|
+
if (typeof modelConfig === 'string') {
|
|
24
|
+
return { name: modelConfig };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
name: modelConfig.modelName,
|
|
28
|
+
...(modelConfig.modelVersion && { version: modelConfig.modelVersion })
|
|
29
|
+
};
|
|
30
|
+
}
|
|
16
31
|
//# sourceMappingURL=model.js.map
|
package/dist/utils/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/utils/model.ts"],"names":[],"mappings":"AAkBA,SAAS,iBAAiB,CACxB,KAA2C;IAE3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAwB;IAExB,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC;IACnE,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,WAAiC;IAEjC,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,SAAS;QAC3B,GAAG,CAAC,WAAW,CAAC,YAAY,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ai-sdk/ai-api",
|
|
3
|
-
"version": "2.5.1-
|
|
3
|
+
"version": "2.5.1-20260127013423.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@sap-cloud-sdk/connectivity": "^4.3.1",
|
|
28
28
|
"@sap-cloud-sdk/util": "^4.3.1",
|
|
29
|
-
"@sap-ai-sdk/core": "^2.5.1-
|
|
29
|
+
"@sap-ai-sdk/core": "^2.5.1-20260127013423.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"compile": "tsc",
|