| ### Job Description', | ### Job Description', | ||||
| You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value | You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value | ||||
| ### Task | ### Task | ||||
| 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". | |||||
| Your task is to ONLY extract the metadatas that exist in the input text from the provided metadata list and Use the following operators ["contains", "not contains", "start with", "end with", "is", "is not", "empty", "not empty", "=", "≠", ">", "<", "≥", "≤", "before", "after"] 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". | |||||
| ### Format | ### Format | ||||
| The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields. | The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields. | ||||
| ### Constraint | ### Constraint |
| METADATA_FILTER_COMPLETION_PROMPT, | METADATA_FILTER_COMPLETION_PROMPT, | ||||
| METADATA_FILTER_SYSTEM_PROMPT, | METADATA_FILTER_SYSTEM_PROMPT, | ||||
| METADATA_FILTER_USER_PROMPT_1, | METADATA_FILTER_USER_PROMPT_1, | ||||
| METADATA_FILTER_USER_PROMPT_2, | |||||
| METADATA_FILTER_USER_PROMPT_3, | METADATA_FILTER_USER_PROMPT_3, | ||||
| ) | ) | ||||
| from core.workflow.nodes.llm.entities import LLMNodeChatModelMessage, LLMNodeCompletionModelPromptTemplate | from core.workflow.nodes.llm.entities import LLMNodeChatModelMessage, LLMNodeCompletionModelPromptTemplate | ||||
| from core.workflow.nodes.llm.node import LLMNode | from core.workflow.nodes.llm.node import LLMNode | ||||
| from core.workflow.nodes.question_classifier.template_prompts import QUESTION_CLASSIFIER_USER_PROMPT_2 | |||||
| from extensions.ext_database import db | from extensions.ext_database import db | ||||
| from extensions.ext_redis import redis_client | from extensions.ext_redis import redis_client | ||||
| from libs.json_in_md_parser import parse_and_check_json_markdown | from libs.json_in_md_parser import parse_and_check_json_markdown | ||||
| ) | ) | ||||
| prompt_messages.append(assistant_prompt_message_1) | prompt_messages.append(assistant_prompt_message_1) | ||||
| user_prompt_message_2 = LLMNodeChatModelMessage( | user_prompt_message_2 = LLMNodeChatModelMessage( | ||||
| role=PromptMessageRole.USER, text=QUESTION_CLASSIFIER_USER_PROMPT_2 | |||||
| role=PromptMessageRole.USER, text=METADATA_FILTER_USER_PROMPT_2 | |||||
| ) | ) | ||||
| prompt_messages.append(user_prompt_message_2) | prompt_messages.append(user_prompt_message_2) | ||||
| assistant_prompt_message_2 = LLMNodeChatModelMessage( | assistant_prompt_message_2 = LLMNodeChatModelMessage( |
| ### Job Description', | ### Job Description', | ||||
| You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value | You are a text metadata extract engine that extract text's metadata based on user input and set the metadata value | ||||
| ### Task | ### Task | ||||
| 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". | |||||
| Your task is to ONLY extract the metadatas that exist in the input text from the provided metadata list and Use the following operators ["contains", "not contains", "start with", "end with", "is", "is not", "empty", "not empty", "=", "≠", ">", "<", "≥", "≤", "before", "after"] 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". | |||||
| ### Format | ### Format | ||||
| The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields. | The input text is in the variable input_text. Metadata are specified as a list in the variable metadata_fields. | ||||
| ### Constraint | ### Constraint |