@sap-ai-sdk/orchestration 1.8.1-20250306013127.0 → 1.9.1-20250307013124.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 +13 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ This package incorporates generative AI orchestration capabilities into your AI
|
|
|
22
22
|
- [Using Resource Groups](#using-resource-groups)
|
|
23
23
|
- [Custom Request Configuration](#custom-request-configuration)
|
|
24
24
|
- [Custom Destination](#custom-destination)
|
|
25
|
+
- [Error Handling](#error-handling)
|
|
25
26
|
- [Local Testing](#local-testing)
|
|
26
27
|
- [Support, Feedback, Contribution](#support-feedback-contribution)
|
|
27
28
|
- [License](#license)
|
|
@@ -369,14 +370,20 @@ try {
|
|
|
369
370
|
const response = await orchestrationClient.chatCompletion({
|
|
370
371
|
inputParams: { input: 'I hate you!' }
|
|
371
372
|
});
|
|
372
|
-
|
|
373
|
+
console.log(response.getContent());
|
|
373
374
|
} catch (error: any) {
|
|
374
|
-
|
|
375
|
+
console.error(error.message);
|
|
376
|
+
console.error(error.cause?.response?.data);
|
|
375
377
|
}
|
|
376
378
|
```
|
|
377
379
|
|
|
378
380
|
Multiple filters can be applied at the same time for both input and output filtering.
|
|
379
381
|
|
|
382
|
+
> [!Note]
|
|
383
|
+
> The `chatCompletion()` method can throw an error with HTTP status code `400` if content filters hit.
|
|
384
|
+
> In case of a `200` HTTP response, the `getContent()` method can throw an error if the output filters hit.
|
|
385
|
+
> See the [error handling](#error-handling) section for more details.
|
|
386
|
+
|
|
380
387
|
#### Azure Content Filter
|
|
381
388
|
|
|
382
389
|
Use `buildAzureContentSafetyFilter()` function to build an Azure content filter.
|
|
@@ -407,19 +414,6 @@ Pass the categories as arguments to the function to enable them.
|
|
|
407
414
|
const filter = buildLlamaGuardFilter('hate', 'violent_crimes');
|
|
408
415
|
```
|
|
409
416
|
|
|
410
|
-
#### Error Handling
|
|
411
|
-
|
|
412
|
-
Both `chatCompletion()` and `getContent()` methods can throw errors.
|
|
413
|
-
|
|
414
|
-
- **Axios Errors**:
|
|
415
|
-
When the chat completion request fails with a `400` status code, the caught error will be an `Axios` error.
|
|
416
|
-
The property `error.response.data.message` provides additional details about the failure.
|
|
417
|
-
|
|
418
|
-
- **Output Content Filtered**:
|
|
419
|
-
The `getContent()` method can throw an error if the output filter filters the model output.
|
|
420
|
-
This can occur even if the chat completion request responds with a `200` HTTP status code.
|
|
421
|
-
The `error.message` property indicates if the output was filtered.
|
|
422
|
-
|
|
423
417
|
### Data Masking
|
|
424
418
|
|
|
425
419
|
You can anonymize or pseudonomize the prompt using the data masking capabilities of the orchestration service.
|
|
@@ -724,6 +718,10 @@ const orchestrationClient = new OrchestrationClient(
|
|
|
724
718
|
By default, the fetched destination is cached.
|
|
725
719
|
To disable caching, set the `useCache` parameter to `false` together with the `destinationName` parameter.
|
|
726
720
|
|
|
721
|
+
## Error Handling
|
|
722
|
+
|
|
723
|
+
For error handling instructions, refer to this [section](https://github.com/SAP/ai-sdk-js/blob/main/README.md#error-handling).
|
|
724
|
+
|
|
727
725
|
## Local Testing
|
|
728
726
|
|
|
729
727
|
For local testing instructions, refer to this [section](https://github.com/SAP/ai-sdk-js/blob/main/README.md#local-testing).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ai-sdk/orchestration",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1-20250307013124.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": "^4.0.1",
|
|
24
|
-
"@sap-ai-sdk/core": "^1.
|
|
25
|
-
"@sap-ai-sdk/ai-api": "^1.
|
|
24
|
+
"@sap-ai-sdk/core": "^1.9.1-20250307013124.0",
|
|
25
|
+
"@sap-ai-sdk/ai-api": "^1.9.1-20250307013124.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@sap-cloud-sdk/http-client": "^4.0.1",
|