|
831 | 831 | DELETE_ENTITIES_AND_START_FROM_BEGINNING = "delete_entities_and_start_from_beginning" |
832 | 832 | START_FROM_LAST_PROCESSED_POSITION = "start_from_last_processed_position" |
833 | 833 |
|
834 | | -GRAPH_CLEANUP_PROMPT = """Please consolidate the following list of types into a smaller set of more general, semantically |
835 | | -related types. The consolidated types must be drawn from the original list; do not introduce new types. |
836 | | -Return a JSON object representing the mapping of original types to consolidated types. Every key is the consolidated type |
837 | | -and value is list of the original types that were merged into the consolidated type. Prioritize using the most generic and |
838 | | -repeated term when merging. If a type doesn't merge with any other type, it should still be included in the output, |
839 | | -mapped to itself. |
840 | | -
|
841 | | -**Input:** A list of strings representing the types to be consolidated. These types may represent either node |
842 | | -labels or relationship labels Your algorithm should do appropriate groupings based on semantic similarity. |
843 | | -
|
844 | | -Example 1: |
845 | | -Input: |
846 | | -[ "Person", "Human", "People", "Company", "Organization", "Product"] |
847 | | -Output : |
848 | | -[Person": ["Person", "Human", "People"], Organization": ["Company", "Organization"], Product": ["Product"]] |
849 | | -
|
850 | | -Example 2: |
851 | | -Input : |
852 | | -["CREATED_FOR", "CREATED_TO", "CREATED", "PLACE", "LOCATION", "VENUE"] |
| 834 | +GRAPH_CLEANUP_PROMPT = """ |
| 835 | +You are tasked with organizing a list of types into semantic categories based on their meanings, including synonyms or morphological similarities. The input will include two separate lists: one for **Node Labels** and one for **Relationship Types**. Follow these rules strictly: |
| 836 | +### 1. Input Format |
| 837 | +The input will include two keys: |
| 838 | +- `nodes`: A list of node labels. |
| 839 | +- `relationships`: A list of relationship types. |
| 840 | +### 2. Grouping Rules |
| 841 | +- Group similar items into **semantic categories** based on their meaning or morphological similarities. |
| 842 | +- The name of each category must be chosen from the types in the input list (node labels or relationship types). **Do not create or infer new names for categories**. |
| 843 | +- Items that cannot be grouped must remain in their own category. |
| 844 | +### 3. Naming Rules |
| 845 | +- The category name must reflect the grouped items and must be an existing type in the input list. |
| 846 | +- Use a widely applicable type as the category name. |
| 847 | +- **Do not introduce new names or types** under any circumstances. |
| 848 | +### 4. Output Rules |
| 849 | +- Return the output as a JSON object with two keys: |
| 850 | + - `nodes`: A dictionary where each key represents a category name for nodes, and its value is a list of original node labels in that category. |
| 851 | + - `relationships`: A dictionary where each key represents a category name for relationships, and its value is a list of original relationship types in that category. |
| 852 | +- Every key and value must come from the provided input lists. |
| 853 | +### 5. Examples |
| 854 | +#### Example 1: |
| 855 | +Input: |
| 856 | +{{ |
| 857 | + "nodes": ["Person", "Human", "People", "Company", "Organization", "Product"], |
| 858 | + "relationships": ["CREATED_FOR", "CREATED_TO", "CREATED", "PUBLISHED","PUBLISHED_BY", "PUBLISHED_IN", "PUBLISHED_ON"] |
| 859 | +}} |
| 860 | +Output in JSON: |
| 861 | +{{ |
| 862 | + "nodes": {{ |
| 863 | + "Person": ["Person", "Human", "People"], |
| 864 | + "Organization": ["Company", "Organization"], |
| 865 | + "Product": ["Product"] |
| 866 | + }}, |
| 867 | + "relationships": {{ |
| 868 | + "CREATED": ["CREATED_FOR", "CREATED_TO", "CREATED"], |
| 869 | + "PUBLISHED": ["PUBLISHED_BY", "PUBLISHED_IN", "PUBLISHED_ON"] |
| 870 | + }} |
| 871 | +}} |
| 872 | +#### Example 2: Avoid redundant or incorrect grouping |
| 873 | +Input: |
| 874 | +{{ |
| 875 | + "nodes": ["Process", "Process_Step", "Step", "Procedure", "Method", "Natural Process", "Step"], |
| 876 | + "relationships": ["USED_FOR", "USED_BY", "USED_WITH", "USED_IN"] |
| 877 | +}} |
853 | 878 | Output: |
854 | | -["CREATED": ["CREATED_FOR", "CREATED_TO", "CREATED"],"PLACE": ["PLACE", "LOCATION", "VENUE"]] |
| 879 | +{{ |
| 880 | + "nodes": {{ |
| 881 | + "Process": ["Process", "Process_Step", "Step", "Procedure", "Method", "Natural Process"] |
| 882 | + }}, |
| 883 | + "relationships": {{ |
| 884 | + "USED": ["USED_FOR", "USED_BY", "USED_WITH", "USED_IN"] |
| 885 | + }} |
| 886 | +}} |
| 887 | +### 6. Key Rule |
| 888 | +If any item cannot be grouped, it must remain in its own category using its original name. Do not repeat values or create incorrect mappings. |
| 889 | +Use these rules to group and name categories accurately without introducing errors or new types. |
855 | 890 | """ |
856 | 891 |
|
857 | 892 | ADDITIONAL_INSTRUCTIONS = """Your goal is to identify and categorize entities while ensuring that specific data |
|
0 commit comments