@sap-ai-sdk/orchestration 1.4.1-20241213013144.0 → 1.4.1-20241213113708.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/README.md
CHANGED
|
@@ -4,9 +4,8 @@ SAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI
|
|
|
4
4
|
|
|
5
5
|
This package incorporates generative AI orchestration capabilities into your AI activities in SAP AI Core and SAP AI Launchpad.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Table of Contents
|
|
8
8
|
|
|
9
|
-
- [Table of Contents](#table-of-contents)
|
|
10
9
|
- [Installation](#installation)
|
|
11
10
|
- [Prerequisites](#prerequisites)
|
|
12
11
|
- [Orchestration Service](#orchestration-service)
|
|
@@ -18,6 +17,7 @@ This package incorporates generative AI orchestration capabilities into your AI
|
|
|
18
17
|
- [Grounding](#grounding)
|
|
19
18
|
- [Using Resource Groups](#using-resource-groups)
|
|
20
19
|
- [Custom Request Configuration](#custom-request-configuration)
|
|
20
|
+
- [Custom Destination](#custom-destination)
|
|
21
21
|
- [Local Testing](#local-testing)
|
|
22
22
|
- [Support, Feedback, Contribution](#support-feedback-contribution)
|
|
23
23
|
- [License](#license)
|
|
@@ -369,6 +369,29 @@ const response = await orchestrationClient.chatCompletion(
|
|
|
369
369
|
);
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
+
### Custom Destination
|
|
373
|
+
|
|
374
|
+
When initializing the `OrchestrationClient` client, it is possible to provide a custom destination.
|
|
375
|
+
For example, when targeting a destination with the name `my-destination`, the following code can be used:
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
const orchestrationClient = new OrchestrationClient(
|
|
379
|
+
{
|
|
380
|
+
llm,
|
|
381
|
+
templating
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
resourceGroup: 'default'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
destinationName: 'my-destination'
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
By default, the fetched destination is cached.
|
|
393
|
+
To disable caching, set the `useCache` parameter to `false` together with the `destinationName` parameter.
|
|
394
|
+
|
|
372
395
|
## Local Testing
|
|
373
396
|
|
|
374
397
|
For local testing instructions, refer to this [section](https://github.com/SAP/ai-sdk-js/blob/main/README.md#local-testing).
|
|
@@ -3,18 +3,21 @@ import type { CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
|
3
3
|
import type { ResourceGroupConfig } from '@sap-ai-sdk/ai-api/internal.js';
|
|
4
4
|
import type { CompletionPostRequest } from './client/api/schema/index.js';
|
|
5
5
|
import type { OrchestrationModuleConfig, Prompt } from './orchestration-types.js';
|
|
6
|
+
import type { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
6
7
|
/**
|
|
7
8
|
* Get the orchestration client.
|
|
8
9
|
*/
|
|
9
10
|
export declare class OrchestrationClient {
|
|
10
11
|
private config;
|
|
11
12
|
private deploymentConfig?;
|
|
13
|
+
private destination?;
|
|
12
14
|
/**
|
|
13
15
|
* Creates an instance of the orchestration client.
|
|
14
16
|
* @param config - Orchestration module configuration.
|
|
15
17
|
* @param deploymentConfig - Deployment configuration.
|
|
18
|
+
* @param destination - The destination to use for the request.
|
|
16
19
|
*/
|
|
17
|
-
constructor(config: OrchestrationModuleConfig, deploymentConfig?: ResourceGroupConfig | undefined);
|
|
20
|
+
constructor(config: OrchestrationModuleConfig, deploymentConfig?: ResourceGroupConfig | undefined, destination?: HttpDestinationOrFetchOptions | undefined);
|
|
18
21
|
/**
|
|
19
22
|
* Creates a completion for the chat messages.
|
|
20
23
|
* @param prompt - Prompt configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-client.d.ts","sourceRoot":"","sources":["../src/orchestration-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EACV,yBAAyB,EACzB,MAAM,EACP,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestration-client.d.ts","sourceRoot":"","sources":["../src/orchestration-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EACV,yBAAyB,EACzB,MAAM,EACP,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,qBAAa,mBAAmB;IAQ5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,gBAAgB,CAAC;IACzB,OAAO,CAAC,WAAW,CAAC;IATtB;;;;;OAKG;gBAEO,MAAM,EAAE,yBAAyB,EACjC,gBAAgB,CAAC,EAAE,mBAAmB,YAAA,EACtC,WAAW,CAAC,EAAE,6BAA6B,YAAA;IAGrD;;;;;OAKG;IACG,cAAc,CAClB,MAAM,CAAC,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,qBAAqB,CAAC;CAmBlC;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,yBAAyB,EACjC,MAAM,CAAC,EAAE,MAAM,GACd,qBAAqB,CA0BvB"}
|
|
@@ -7,14 +7,17 @@ import { OrchestrationResponse } from './orchestration-response.js';
|
|
|
7
7
|
export class OrchestrationClient {
|
|
8
8
|
config;
|
|
9
9
|
deploymentConfig;
|
|
10
|
+
destination;
|
|
10
11
|
/**
|
|
11
12
|
* Creates an instance of the orchestration client.
|
|
12
13
|
* @param config - Orchestration module configuration.
|
|
13
14
|
* @param deploymentConfig - Deployment configuration.
|
|
15
|
+
* @param destination - The destination to use for the request.
|
|
14
16
|
*/
|
|
15
|
-
constructor(config, deploymentConfig) {
|
|
17
|
+
constructor(config, deploymentConfig, destination) {
|
|
16
18
|
this.config = config;
|
|
17
19
|
this.deploymentConfig = deploymentConfig;
|
|
20
|
+
this.destination = destination;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Creates a completion for the chat messages.
|
|
@@ -31,7 +34,7 @@ export class OrchestrationClient {
|
|
|
31
34
|
const response = await executeRequest({
|
|
32
35
|
url: `/inference/deployments/${deploymentId}/completion`,
|
|
33
36
|
resourceGroup: this.deploymentConfig?.resourceGroup
|
|
34
|
-
}, body, requestConfig);
|
|
37
|
+
}, body, requestConfig, this.destination);
|
|
35
38
|
return new OrchestrationResponse(response);
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-client.js","sourceRoot":"","sources":["../src/orchestration-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestration-client.js","sourceRoot":"","sources":["../src/orchestration-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAUpE;;GAEG;AACH,MAAM,OAAO,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I;oBAC/C,qBAAqB,EAAE,MAAM,CAAC,OAAO;iBACtC,CAAC;gBACF,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,IAAI;oBACjD,uBAAuB,EAAE,MAAM,CAAC,SAAS;iBAC1C,CAAC;aACH;SACF;QACD,GAAG,CAAC,MAAM,EAAE,WAAW,IAAI;YACzB,YAAY,EAAE,MAAM,CAAC,WAAW;SACjC,CAAC;QACF,GAAG,CAAC,MAAM,EAAE,eAAe,IAAI;YAC7B,gBAAgB,EAAE,MAAM,CAAC,eAAe;SACzC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ai-sdk/orchestration",
|
|
3
|
-
"version": "1.4.1-
|
|
3
|
+
"version": "1.4.1-20241213113708.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@sap-cloud-sdk/http-client": "^3.24.0",
|
|
24
|
-
"@sap-
|
|
25
|
-
"@sap-ai-sdk/
|
|
24
|
+
"@sap-cloud-sdk/connectivity": "^3.24.0",
|
|
25
|
+
"@sap-ai-sdk/core": "^1.4.1-20241213113708.0",
|
|
26
|
+
"@sap-ai-sdk/ai-api": "^1.4.1-20241213113708.0"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"compile": "tsc",
|