Views
No views yet
pii-phi is a fine-tuned version of Phi-3.5-mini-instruct designed to extract Personally Identifiable Information (PII) from unstructured text. The model outputs PII entities in a structured JSON format according to strict schema guidelines.1# GUIDELINES
2- Extract all instances of the following Personally Identifiable Information (PII) entities from the provided text and return them in JSON format.
3- Each item in the JSON list should include an 'entity' key specifying the type of PII and a 'value' key containing the extracted information.
4- The supported entities are: PERSON_NAME, BUSINESS_NAME, API_KEY, USERNAME, API_ENDPOINT, WEBSITE_ADDRESS, PHONE_NUMBER, EMAIL_ADDRESS, ID, PASSWORD, ADDRESS.
5
6# EXPECTED OUTPUT
7- The json output must be in the format below:
8{
9 "result": [
10 {"entity": "ENTITY_TYPE", "value": "EXTRACTED_VALUE"},
11 ...
12 ]
13}vllm package to run the model efficiently:pip install vllm1from vllm import LLM, SamplingParams
2
3llm = LLM("Fsoft-AIC/pii-phi")
4
5system_prompt = """
6# GUIDELINES
7- Extract all instances of the following Personally Identifiable Information (PII) entities from the provided text and return them in JSON format.
8- Each item in the JSON list should include an 'entity' key specifying the type of PII and a 'value' key containing the extracted information.
9- The supported entities are: PERSON_NAME, BUSINESS_NAME, API_KEY, USERNAME, API_ENDPOINT, WEBSITE_ADDRESS, PHONE_NUMBER, EMAIL_ADDRESS, ID, PASSWORD, ADDRESS.
10
11# EXPECTED OUTPUT
12- The json output must be in the format below:
13{
14 "result": [
15 {"entity": "ENTITY_TYPE", "value": "EXTRACTED_VALUE"},
16 ...
17 ]
18}
19"""
20pii_message = "I am James Jake and my employee number is 123123123"
21
22sampling_params = SamplingParams(temperature=0, max_tokens=1000)
23outputs = llm.chat(
24 [
25 {"role": "system", "content": system_prompt},
26 {"role": "user", "content": pii_message},
27 ],
28 sampling_params,
29)
30
31
32for output in outputs:
33 generated_text = output.outputs[0].text
34 print(generated_text)