diff --git a/packages/orchestration/README.md b/packages/orchestration/README.md index a5abcec04..1f0355c4c 100644 --- a/packages/orchestration/README.md +++ b/packages/orchestration/README.md @@ -369,7 +369,10 @@ import { buildAzureContentFilter } from '@sap-ai-sdk/orchestration'; -const filter = buildAzureContentFilter({ Hate: 2, Violence: 4 }); +const filter = buildAzureContentFilter({ + Hate: AzureFilterThreshold.ALLOW_SAFE_LOW, + Violence: AzureFilterThreshold.ALLOW_SAFE_LOW_MEDIUM +}); const orchestrationClient = new OrchestrationClient({ llm: { model_name: 'gpt-4o', @@ -409,7 +412,7 @@ Therefore, handle errors appropriately to ensure meaningful feedback for both ty `buildAzureContentFilter()` is a convenience function that creates an Azure content filter configuration based on the provided inputs. The Azure content filter supports four categories: `Hate`, `Violence`, `Sexual`, and `SelfHarm`. -Each category can be configured with severity levels of 0, 2, 4, or 6. +Each category can be configured with severity levels of `ALLOW_SAFE`, `ALLOW_SAFE_LOW`, `ALLOW_SAFE_LOW_MEDIUM` and `ALLOW_ALL` which correspond to Azure threshold values of 0, 2, 4, or 6 respectively. ### Data Masking diff --git a/packages/orchestration/src/orchestration-types.ts b/packages/orchestration/src/orchestration-types.ts index fb00c321f..054c56b11 100644 --- a/packages/orchestration/src/orchestration-types.ts +++ b/packages/orchestration/src/orchestration-types.ts @@ -153,24 +153,24 @@ export interface DocumentGroundingServiceConfig { } /** - * A descriptive type for AzureThreshold input. + * Filter configuration for Azure Content Safety. */ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions export type AzureContentSafety = { /** - * Filter configuration for Hate. + * The filter category for hate content. */ Hate?: AzureFilterThreshold; /** - * Filter configuration for SelfHarm. + * The filter category for self-harm content. */ SelfHarm?: AzureFilterThreshold; /** - * Filter configuration for Sexual. + * The filter category for sexual content. */ Sexual?: AzureFilterThreshold; /** - * Filter configuration for Violence. + * The filter category for violence content. */ Violence?: AzureFilterThreshold; }; @@ -179,12 +179,12 @@ export type AzureContentSafety = { * A descriptive constant for Azure content safety filter. */ export enum AzureFilterThreshold { - /** Allows only safe content. */ + /** Only safe content is allowed. */ ALLOW_SAFE = 0, - /** Allows safe content and low-risk content. */ + /** Safe and low-risk content is allowed. */ ALLOW_SAFE_LOW = 2, - /** Allows safe, low-risk, and medium-risk content. */ + /** Safe, low-risk, and medium-risk content is allowed. */ ALLOW_SAFE_LOW_MEDIUM = 4, - /** Allows all content. */ + /** All content is allowed. */ ALLOW_ALL = 6 }