Update README.md
Browse files
README.md
CHANGED
@@ -41,4 +41,55 @@ The model is intended for PII detection in text documents to support tasks such
|
|
41 |
### Limitations
|
42 |
|
43 |
* Not guaranteed to detect all forms of PII in every context.
|
44 |
-
* May return false positives or omit contextually relevant information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
### Limitations
|
42 |
|
43 |
* Not guaranteed to detect all forms of PII in every context.
|
44 |
+
* May return false positives or omit contextually relevant information.
|
45 |
+
|
46 |
+
---
|
47 |
+
|
48 |
+
### Installation
|
49 |
+
|
50 |
+
Install the `vllm` package to run the model efficiently:
|
51 |
+
|
52 |
+
```bash
|
53 |
+
pip install vllm
|
54 |
+
```
|
55 |
+
|
56 |
+
---
|
57 |
+
|
58 |
+
### Example:
|
59 |
+
|
60 |
+
```python
|
61 |
+
from vllm import LLM, SamplingParams
|
62 |
+
|
63 |
+
llm = LLM("Fsoft-AIC/pii-phi")
|
64 |
+
|
65 |
+
system_prompt = """
|
66 |
+
# GUIDELINES
|
67 |
+
- Extract all instances of the following Personally Identifiable Information (PII) entities from the provided text and return them in JSON format.
|
68 |
+
- Each item in the JSON list should include an 'entity' key specifying the type of PII and a 'value' key containing the extracted information.
|
69 |
+
- The supported entities are: PERSON_NAME, BUSINESS_NAME, API_KEY, USERNAME, API_ENDPOINT, WEBSITE_ADDRESS, PHONE_NUMBER, EMAIL_ADDRESS, ID, PASSWORD, ADDRESS.
|
70 |
+
|
71 |
+
# EXPECTED OUTPUT
|
72 |
+
- The json output must be in the format below:
|
73 |
+
{
|
74 |
+
"result": [
|
75 |
+
{"entity": "ENTITY_TYPE", "value": "EXTRACTED_VALUE"},
|
76 |
+
...
|
77 |
+
]
|
78 |
+
}
|
79 |
+
"""
|
80 |
+
pii_message = "I am James Jake and my employee number is 123123123"
|
81 |
+
|
82 |
+
sampling_params = SamplingParams(temperature=0, max_tokens=1000)
|
83 |
+
outputs = llm.chat(
|
84 |
+
[
|
85 |
+
{"role": "system", "content": system_prompt},
|
86 |
+
{"role": "user", "content": pii_message},
|
87 |
+
],
|
88 |
+
sampling_params,
|
89 |
+
)
|
90 |
+
|
91 |
+
|
92 |
+
for output in outputs:
|
93 |
+
generated_text = output.outputs[0].text
|
94 |
+
print(generated_text)
|
95 |
+
```
|