@sap-ai-sdk/orchestration 1.7.1-20250131013050.0 → 1.7.1-20250202013054.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
|
@@ -11,7 +11,9 @@ This package incorporates generative AI orchestration capabilities into your AI
|
|
|
11
11
|
- [Orchestration Service](#orchestration-service)
|
|
12
12
|
- [Relationship between Orchestration and Resource Groups](#relationship-between-orchestration-and-resource-groups)
|
|
13
13
|
- [Usage](#usage)
|
|
14
|
+
- [LLM Config](#llm-config)
|
|
14
15
|
- [Templating](#templating)
|
|
16
|
+
- [Prompt Registry](#prompt-registry)
|
|
15
17
|
- [Content Filtering](#content-filtering)
|
|
16
18
|
- [Data Masking](#data-masking)
|
|
17
19
|
- [Grounding](#grounding)
|
|
@@ -65,28 +67,44 @@ Consequently, each orchestration deployment uniquely maps to a resource group wi
|
|
|
65
67
|
## Usage
|
|
66
68
|
|
|
67
69
|
Leverage the orchestration service capabilities by using the orchestration client.
|
|
68
|
-
|
|
69
|
-
Define the optional `model_version` property to choose an available model version.
|
|
70
|
-
By default, the version is set to `latest`.
|
|
71
|
-
Specify the optional `model_params` property to apply specific parameters to the model
|
|
70
|
+
You can perform a simple prompt by running:
|
|
72
71
|
|
|
73
72
|
```ts
|
|
74
73
|
import { OrchestrationClient } from '@sap-ai-sdk/orchestration';
|
|
75
74
|
|
|
76
75
|
const orchestrationClient = new OrchestrationClient({
|
|
77
76
|
llm: {
|
|
78
|
-
model_name: 'gpt-4o'
|
|
79
|
-
model_params: { max_tokens: 50, temperature: 0.1 },
|
|
80
|
-
model_version: 'latest'
|
|
77
|
+
model_name: 'gpt-4o'
|
|
81
78
|
},
|
|
82
|
-
|
|
79
|
+
templating: {
|
|
80
|
+
template: [
|
|
81
|
+
{ role: 'user', content: 'Hello World! Why is this phrase so famous?' }
|
|
82
|
+
]
|
|
83
|
+
}
|
|
83
84
|
});
|
|
85
|
+
|
|
86
|
+
const response = await orchestrationClient.chatCompletion();
|
|
87
|
+
console.log(response.getContent());
|
|
84
88
|
```
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
Here we use GPT-4o with a single user message as prompt and print out the response.
|
|
91
|
+
|
|
92
|
+
The `OrchestrationClient` enables combining various modules, such as templating and content filtering, while sending chat completion requests to an orchestration-compatible generative AI model.
|
|
87
93
|
|
|
88
94
|
In addition to the examples below, you can find more **sample code** [here](https://github.com/SAP/ai-sdk-js/blob/main/sample-code/src/orchestration.ts).
|
|
89
95
|
|
|
96
|
+
### LLM Config
|
|
97
|
+
|
|
98
|
+
Choose the LLM by setting the `model_name` property.
|
|
99
|
+
Optionally, define `model_version` (default: `latest`) and `model_params` for custom settings.
|
|
100
|
+
|
|
101
|
+
> [!Tip]
|
|
102
|
+
>
|
|
103
|
+
> #### Harmonized API
|
|
104
|
+
>
|
|
105
|
+
> The Orchestration Service provides a [harmonized API](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/harmonized-api) for all models.
|
|
106
|
+
> Switching to a different model — even from another vendor — only requires changing the `model_name` property.
|
|
107
|
+
|
|
90
108
|
### Templating
|
|
91
109
|
|
|
92
110
|
Use the orchestration client with templating to pass a prompt containing placeholders that will be replaced with input parameters during a chat completion request.
|
|
@@ -135,27 +153,29 @@ console.log(
|
|
|
135
153
|
);
|
|
136
154
|
```
|
|
137
155
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
### Prompt Registry
|
|
157
|
+
|
|
158
|
+
Alternatively, prepared templates from the [Prompt Registry](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/prompt-registry) of SAP AI Core can be used instead of passing a template in the request.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
const orchestrationClient = new OrchestrationClient({
|
|
162
|
+
llm,
|
|
163
|
+
templating: {
|
|
164
|
+
template_ref: {
|
|
165
|
+
name: 'get-capital',
|
|
166
|
+
scenario: 'e2e-test',
|
|
167
|
+
version: '0.0.1'
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return orchestrationClient.chatCompletion({
|
|
173
|
+
inputParams: { input: 'France' }
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
A prompt template can be referenced either by ID, or by using a combination of name, scenario, and version.
|
|
178
|
+
For details on storing a template in the Prompt Registry, refer to [this guide](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/create-prompt-template-imperative).
|
|
159
179
|
|
|
160
180
|
#### Passing a Message History
|
|
161
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llama-guard-38-b-filter-config.d.ts","sourceRoot":"","sources":["../../../../src/client/api/schema/llama-guard-38-b-filter-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"llama-guard-38-b-filter-config.d.ts","sourceRoot":"","sources":["../../../../src/client/api/schema/llama-guard-38-b-filter-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ai-sdk/orchestration",
|
|
3
|
-
"version": "1.7.1-
|
|
3
|
+
"version": "1.7.1-20250202013054.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@sap-cloud-sdk/util": "^3.26.0",
|
|
24
|
-
"@sap-ai-sdk/core": "^1.7.1-
|
|
25
|
-
"@sap-ai-sdk/ai-api": "^1.7.1-
|
|
24
|
+
"@sap-ai-sdk/core": "^1.7.1-20250202013054.0",
|
|
25
|
+
"@sap-ai-sdk/ai-api": "^1.7.1-20250202013054.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@sap-cloud-sdk/http-client": "^3.26.0",
|