-
I am using code given in the example: Context Transformations - PII Example I am getting lot better response, however I am also getting this warning. How I rectify that error? please advise:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
To rectify the warning messages you're encountering, you can take the following steps:
Here is an updated version of your code snippet: from transformers import pipeline
# Specify the model name and revision
model_name = "dbmdz/bert-large-cased-finetuned-conll03-english"
revision = "f2482bf"
# Create the NER pipeline with the specified model and revision
ner = pipeline("ner", model=model_name, revision=revision, aggregation_strategy="simple")
# Example text
text = """
Hello Paulo Santos. The latest statement for your credit card account \
1111-0000-1111-0000 was mailed to 123 Any Street, Seattle, WA 98109.
"""
# Process the text
response = ner(text)
print(response) This should help in addressing the warnings related to the model checkpoint and the deprecation of |
Beta Was this translation helpful? Give feedback.
-
@dosu. Thank you and it did work. However, I like to know some additional details on 'Context Transformations - PII Example from this link... https://docs.llamaindex.ai/en/stable/examples/prompts/prompts_rag/ Can you expalin what this code really doing for prompt? I am sure I am getting good response, but I like to know under the hood what it is doing for the prompt. The combined code in this example is given below....
|
Beta Was this translation helpful? Give feedback.
The provided code is designed to filter out personally identifiable information (PII) from context strings in a prompt for a question-answering (QA) system using the
NERPIINodePostprocessor
. Here's a detailed breakdown of what each part of the code does:PII Processing:
NERPIINodePostprocessor
is initialized with a language model (gpt4_llm
).filter_pii_fn
function is defined to process nodes containing text and remove any PII before they are included in the prompt. It creates aQueryBundle
from the input query string and processes the context string to return a sanitized version.