template_prompts.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. METADATA_FILTER_SYSTEM_PROMPT = """
  2. ### Job Description',
  3. You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value
  4. ### Task
  5. Your task is to ONLY extract the metadatas that exist in the input text from the provided metadata list and Use the following operators ["=", "!=", ">", "<", ">=", "<="] to express logical relationships, then return result in JSON format with the key "metadata_fields" and value "metadata_field_value" and comparison operator "comparison_operator".
  6. ### Format
  7. The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields.
  8. ### Constraint
  9. DO NOT include anything other than the JSON array in your response.
  10. """ # noqa: E501
  11. METADATA_FILTER_USER_PROMPT_1 = """
  12. { "input_text": "I want to know which company’s email address test@example.com is?",
  13. "metadata_fields": ["filename", "email", "phone", "address"]
  14. }
  15. """
  16. METADATA_FILTER_ASSISTANT_PROMPT_1 = """
  17. ```json
  18. {"metadata_map": [
  19. {"metadata_field_name": "email", "metadata_field_value": "test@example.com", "comparison_operator": "="}
  20. ]
  21. }
  22. ```
  23. """
  24. METADATA_FILTER_USER_PROMPT_2 = """
  25. {"input_text": "What are the movies with a score of more than 9 in 2024?",
  26. "metadata_fields": ["name", "year", "rating", "country"]}
  27. """
  28. METADATA_FILTER_ASSISTANT_PROMPT_2 = """
  29. ```json
  30. {"metadata_map": [
  31. {"metadata_field_name": "year", "metadata_field_value": "2024", "comparison_operator": "="},
  32. {"metadata_field_name": "rating", "metadata_field_value": "9", "comparison_operator": ">"},
  33. ]}
  34. ```
  35. """
  36. METADATA_FILTER_USER_PROMPT_3 = """
  37. '{{"input_text": "{input_text}",',
  38. '"metadata_fields": {metadata_fields}}}'
  39. """
  40. METADATA_FILTER_COMPLETION_PROMPT = """
  41. ### Job Description
  42. You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value
  43. ### Task
  44. # Your task is to ONLY extract the metadatas that exist in the input text from the provided metadata list and Use the following operators ["=", "!=", ">", "<", ">=", "<="] to express logical relationships, then return result in JSON format with the key "metadata_fields" and value "metadata_field_value" and comparison operator "comparison_operator".
  45. ### Format
  46. The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields.
  47. ### Constraint
  48. DO NOT include anything other than the JSON array in your response.
  49. ### Example
  50. Here is the chat example between human and assistant, inside <example></example> XML tags.
  51. <example>
  52. User:{{"input_text": ["I want to know which company’s email address test@example.com is?"], "metadata_fields": ["filename", "email", "phone", "address"]}}
  53. Assistant:{{"metadata_map": [{{"metadata_field_name": "email", "metadata_field_value": "test@example.com", "comparison_operator": "="}}]}}
  54. User:{{"input_text": "What are the movies with a score of more than 9 in 2024?", "metadata_fields": ["name", "year", "rating", "country"]}}
  55. Assistant:{{"metadata_map": [{{"metadata_field_name": "year", "metadata_field_value": "2024", "comparison_operator": "="}, {{"metadata_field_name": "rating", "metadata_field_value": "9", "comparison_operator": ">"}}]}}
  56. </example>
  57. ### User Input
  58. {{"input_text" : "{input_text}", "metadata_fields" : {metadata_fields}}}
  59. ### Assistant Output
  60. """ # noqa: E501