|
| 1 | +# Presidio Sample |
| 2 | + |
| 3 | +This sample demonstrates how to use Presidio with Semantic Kernel to redact sensitive data from a prompt. A sample |
| 4 | +output from this example is shown below: |
| 5 | + |
| 6 | +``` |
| 7 | +============================== |
| 8 | +Input text is: |
| 9 | +The users name is: Steven. |
| 10 | +Steven has account number 012345612. |
| 11 | +Steven was born in New York and their mother is Sally. |
| 12 | +============================== |
| 13 | +Anonymised text is: |
| 14 | +The users name is: PERSON4. |
| 15 | +PERSON4 has account number AU_ACN3. |
| 16 | +PERSON4 was born in LOCATION1 and their mother is PERSON2. |
| 17 | +
|
| 18 | +============================== |
| 19 | +User Question: |
| 20 | +Question: Where was the user born? |
| 21 | +============================== |
| 22 | +Anonymised response: |
| 23 | +The user was born in LOCATION1. |
| 24 | +============================== |
| 25 | +Deanonymised response: |
| 26 | +The user was born in New York. |
| 27 | +
|
| 28 | +============================== |
| 29 | +User Question: |
| 30 | +Question: Who is the users mother? |
| 31 | +============================== |
| 32 | +Anonymised response: |
| 33 | +The user's mother is PERSON2. |
| 34 | +============================== |
| 35 | +Deanonymised response: |
| 36 | +The user's mother is Sally. |
| 37 | +``` |
| 38 | + |
| 39 | +# App structure |
| 40 | + |
| 41 | +The [semantickernel-presidio-plugin](..%2F..%2Fsemantickernel-sample-plugins%2Fsemantickernel-presidio-plugin) plugin |
| 42 | +takes user text and runs it through Presidio to redact sensitive data. The plugin then returns the redacted text. The |
| 43 | +redacted information is then sent to an LLM for processing. The response is then de-anonymised. |
| 44 | + |
| 45 | +# Build and Run |
| 46 | + |
| 47 | +As this example depends on running Presidio, it run within docker containers using docker compose. |
| 48 | + |
| 49 | +- Before building and running ensure that you have run `./mvnw install` on the semantic kernel you wish to use. |
| 50 | +- Copy [env.example](env.example) to `.env` and update the values as needed. |
| 51 | +- Run [buildAndRun.sh](buildAndRun.sh) |
0 commit comments