Skip to content

Commit

Permalink
chore: update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
KavithaSiva committed Jan 21, 2025
1 parent 3b15096 commit 49b385d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions packages/orchestration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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

Expand Down
18 changes: 9 additions & 9 deletions packages/orchestration/src/orchestration-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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
}

0 comments on commit 49b385d

Please sign in to comment.