lightudq.prompts API documentation

# lightudq.prompts

View Source

      1QNA_EXTRACT_PROMPT = """You are an advanced text analysis system designed to extract key
      2information from documents in the form of question-answer pairs. Your task is to analyze the given document
      3and create up to {num_questions} question-answer pairs based on the information directly addressed in the text.
      4
      5First, carefully read the following document:
      6
      7<document>
      8{document}
      9</document>
     10
     11Then extract key questions and their corresponding answers from the document.  The answer in each question-answer pair
     12should be self-contained and fully comprehensible without needing to refer back to the question or the original document.
     13
     14After completing your analysis, please format your output as a JSON object that adheres to the following
     15schema:
     16
     17<output_schema>
     18{output_schema}
     19</output_schema>
     20
     21
     22Remember:
     23- The answer in each question-answer pair  should be self-contained and fully comprehensible without needing to refer
     24 back to the question or the original document.
     25- Your final output must be strictly in the JSON format specified by the output_schema.
     26- Double-check your JSON structure before finalizing your response.
     27- Do not output any reasoning or justifications
     28"""
     29
     30
     31MISSING_QUESTIONS_PROMPT = """Check if the following document answers the following questions.
     32<document>
     33{document}
     34</document>
     35
     36<questions>
     37{questions}
     38</questions>
     39
     40Output just the list of questions (if any) not answered by the document, with the following output schema.
     41<output_schema>
     42{output_schema}
     43</output_schema>
     44"""
     45
     46
     47FACT_CHECK_PROMPT = """You are a precise and thorough fact-checker. Your task is to verify if a given document directly
     48contradicts a set of provided facts. You must ignore any facts that are not present in the document.
     49Here is the document to analyze:
     50<document>
     51{document}
     52</document>
     53
     54Here are the facts to check:
     55<facts>
     56{facts}
     57</facts>
     58
     59Here is the schema for the JSON output you must produce:
     60<output_schema>
     61{output_schema}
     62</output_schema>
     63
     64Please follow these steps:
     65
     661. Carefully read the document provided.
     672. For each fact in the list of facts:
     68   a. Determine if the document directly contradicts the fact. Note that :
     69        - Any extra information in the fact not present in the document should not be considered a contradiction and
     70        be ignored.
     71        - If the document describes a different procedure to accomplish the same task in the fact, this should not
     72        constitute a contradiction unless the document explicitly states that the described procedure is the only way
     73        to accomplish the task
     74   b. If fact is not contradicted by the document, ignore the fact.
     75   c. If fact is contradicted, capture it in output
     762. For each fact in the list of facts:
     77   a. Determine if the document directly contradicts the fact. Any extra information in the fact not present in the
     78   document should not be considered a contradiction and be ignored.
     79   b. If fact is not contradicted by the document, ignore the fact.
     80   c. If fact is contradicted, capture it in output
     81
     823. Construct your output in the JSON format specified by the output_schema.
     83
     84Examples:
     85fact: "an apple is a fruit"
     86document: "an orange is a fruit".
     87result: no contradiction
     88
     89fact: "an apple is a fruit and can be eaten after cutting by knife"
     90document: "an apple is a fruit"
     91result: no contradiction
     92
     93fact: "an apple is a fruit and can be eaten after cutting by knife"
     94document: "an apple is a fruit and can be eaten by biting directly into it"
     95result: no contradiction
     96
     97fact: "an apple is a fruit"
     98document: "an apple is a round fruit and can be eaten by biting directly into it"
     99result: no contradiction
    100
    101fact: "an apple is a fruit"
    102document: "an apple is not a fruit"
    103result: contradiction
    104
    105fact: "an apple can be eaten in 3 different ways: (1) biting, (2) slicing, (3) cutting"
    106document: "here are two different ways of eating apple: (1) biting and (2) cutting"
    107result: no contradiction, since extra information in fact not mentioned in document
    108
    109Remember:
    110- Your final output must be strictly in the JSON format specified by the output_schema.
    111- Double-check your JSON structure before finalizing your response.
    112- Do not output any reasoning or justifications.
    113"""
    114
    115PII_PRESENCE_CHECK_PROMPT = """Check if the following document contains any Personally Identifiable Information (PII).
    116<document>
    117{document}
    118</document>
    119
    120Structure the output using this json schema:
    121<output_schema>
    122{output_schema}
    123</output_schema>
    124
    125Do not output any reasoning or justifications.
    126"""
    127
    128SUMMARY_PROMPT = (
    129    "Summarize the following document in no more than 100 words. "
    130    "<document>"
    131    "{document}"
    132    "</document>"
    133)
    134
    135
    136CUSTOM_METRIC_PROMPT = (
    137    "Extract the information requested by the prompt below from the document. "
    138    "<document>"
    139    "{document}"
    140    "</document>"
    141    "<prompt>"
    142    "{prompt}"
    143    "</prompt>"
    144    "Structure the output using this json schema:"
    145    "<output_schema>"
    146    "{output_schema}"
    147    "</output_schema>"
    148)

QNA_EXTRACT_PROMPT = 'You are an advanced text analysis system designed to extract key\ninformation from documents in the form of question-answer pairs. Your task is to analyze the given document\nand create up to {num_questions} question-answer pairs based on the information directly addressed in the text.\n\nFirst, carefully read the following document:\n\n<document>\n{document}\n</document>\n\nThen extract key questions and their corresponding answers from the document. The answer in each question-answer pair\nshould be self-contained and fully comprehensible without needing to refer back to the question or the original document.\n\nAfter completing your analysis, please format your output as a JSON object that adheres to the following\nschema:\n\n<output_schema>\n{output_schema}\n</output_schema>\n\n\nRemember:\n- The answer in each question-answer pair should be self-contained and fully comprehensible without needing to refer\n back to the question or the original document.\n- Your final output must be strictly in the JSON format specified by the output_schema.\n- Double-check your JSON structure before finalizing your response.\n- Do not output any reasoning or justifications\n'
MISSING_QUESTIONS_PROMPT = 'Check if the following document answers the following questions.\n<document>\n{document}\n</document>\n\n<questions>\n{questions}\n</questions>\n\nOutput just the list of questions (if any) not answered by the document, with the following output schema.\n<output_schema>\n{output_schema}\n</output_schema>\n'
FACT_CHECK_PROMPT = 'You are a precise and thorough fact-checker. Your task is to verify if a given document directly\ncontradicts a set of provided facts. You must ignore any facts that are not present in the document.\nHere is the document to analyze:\n<document>\n{document}\n</document>\n\nHere are the facts to check:\n<facts>\n{facts}\n</facts>\n\nHere is the schema for the JSON output you must produce:\n<output_schema>\n{output_schema}\n</output_schema>\n\nPlease follow these steps:\n\n1. Carefully read the document provided.\n2. For each fact in the list of facts:\n a. Determine if the document directly contradicts the fact. Note that :\n - Any extra information in the fact not present in the document should not be considered a contradiction and\n be ignored.\n - If the document describes a different procedure to accomplish the same task in the fact, this should not\n constitute a contradiction unless the document explicitly states that the described procedure is the only way\n to accomplish the task\n b. If fact is not contradicted by the document, ignore the fact.\n c. If fact is contradicted, capture it in output\n2. For each fact in the list of facts:\n a. Determine if the document directly contradicts the fact. Any extra information in the fact not present in the\n document should not be considered a contradiction and be ignored.\n b. If fact is not contradicted by the document, ignore the fact.\n c. If fact is contradicted, capture it in output\n\n3. Construct your output in the JSON format specified by the output_schema.\n\nExamples:\nfact: "an apple is a fruit"\ndocument: "an orange is a fruit".\nresult: no contradiction\n\nfact: "an apple is a fruit and can be eaten after cutting by knife"\ndocument: "an apple is a fruit"\nresult: no contradiction\n\nfact: "an apple is a fruit and can be eaten after cutting by knife"\ndocument: "an apple is a fruit and can be eaten by biting directly into it"\nresult: no contradiction\n\nfact: "an apple is a fruit"\ndocument: "an apple is a round fruit and can be eaten by biting directly into it"\nresult: no contradiction\n\nfact: "an apple is a fruit"\ndocument: "an apple is not a fruit"\nresult: contradiction\n\nfact: "an apple can be eaten in 3 different ways: (1) biting, (2) slicing, (3) cutting"\ndocument: "here are two different ways of eating apple: (1) biting and (2) cutting"\nresult: no contradiction, since extra information in fact not mentioned in document\n\nRemember:\n- Your final output must be strictly in the JSON format specified by the output_schema.\n- Double-check your JSON structure before finalizing your response.\n- Do not output any reasoning or justifications.\n'
PII_PRESENCE_CHECK_PROMPT = 'Check if the following document contains any Personally Identifiable Information (PII).\n<document>\n{document}\n</document>\n\nStructure the output using this json schema:\n<output_schema>\n{output_schema}\n</output_schema>\n\nDo not output any reasoning or justifications.\n'
SUMMARY_PROMPT = 'Summarize the following document in no more than 100 words. <document>{document}</document>'
CUSTOM_METRIC_PROMPT = 'Extract the information requested by the prompt below from the document. <document>{document}</document><prompt>{prompt}</prompt>Structure the output using this json schema:<output_schema>{output_schema}</output_schema>'