generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sap-ai-sdk/orchestration': minor | ||
--- | ||
|
||
[New Functionality] Add support for the data masking capabilities of the orchestration service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,42 @@ try { | |
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. | ||
|
||
#### Data Masking | ||
|
||
You can anonymize or pseudonomize the prompt using the data masking capabilities of the orchestration service. | ||
|
||
```ts | ||
const orchestrationClient = new OrchestrationClient({ | ||
llm: { | ||
model_name: 'gpt-4-32k', | ||
model_params: {} | ||
}, | ||
templating: { | ||
template: [ | ||
{ | ||
role: 'user', | ||
content: | ||
'Please write an email to {{?user}} ({{?email}}), informing them about the amazing capabilities of generative AI! Be brief and concise, write at most 6 sentences.' | ||
} | ||
] | ||
}, | ||
masking: { | ||
masking_providers: [ | ||
{ | ||
type: 'sap_data_privacy_integration', | ||
method: 'pseudonymization', | ||
entities: [{ type: 'profile-email' }, { type: 'profile-person' }] | ||
} | ||
] | ||
} | ||
}); | ||
|
||
const response = await orchestrationClient.chatCompletion({ | ||
inputParams: { user: 'Alice Anderson', email: '[email protected]' } | ||
}); | ||
return response.getContent(); | ||
``` | ||
|
||
## Support, Feedback, Contribution | ||
|
||
Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](https://github.com/SAP/ai-sdk-js/blob/main/CONTRIBUTING.md). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,44 @@ export async function orchestrationOutputFiltering(): Promise<OrchestrationRespo | |
); | ||
} | ||
|
||
/** | ||
* Ask to write an e-mail while masking personal information. | ||
* @returns The message content from the orchestration service in the generative AI hub. | ||
*/ | ||
export async function orchestrationCompletionMasking(): Promise< | ||
string | undefined | ||
> { | ||
const orchestrationClient = new OrchestrationClient({ | ||
llm: { | ||
model_name: 'gpt-4-32k', | ||
model_params: {} | ||
}, | ||
templating: { | ||
template: [ | ||
{ | ||
role: 'user', | ||
content: | ||
'Please write an email to {{?user}} ({{?email}}), informing them about the amazing capabilities of generative AI! Be brief and concise, write at most 6 sentences.' | ||
} | ||
] | ||
}, | ||
masking: { | ||
masking_providers: [ | ||
{ | ||
type: 'sap_data_privacy_integration', | ||
method: 'pseudonymization', | ||
entities: [{ type: 'profile-email' }, { type: 'profile-person' }] | ||
} | ||
] | ||
} | ||
}); | ||
|
||
const response = await orchestrationClient.chatCompletion({ | ||
inputParams: { user: 'Alice Anderson', email: '[email protected]' } | ||
}); | ||
return response.getContent(); | ||
} | ||
|
||
/** | ||
* Ask about the capital of France and send along custom request configuration. | ||
* @returns The orchestration service response. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters