You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hugegraph-llm/src/hugegraph_llm/config/prompt_config.py
+41-19Lines changed: 41 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -44,38 +44,60 @@ class PromptConfig(BasePromptConfig):
44
44
extract_graph_prompt: str="""## Main Task
45
45
Given the following graph schema and a piece of text, your task is to analyze the text and extract information that fits into the schema's structure, formatting the information into vertices and edges as specified.
46
46
47
-
## Basic Rules
48
-
### Schema Format
47
+
## Basic Rules:
48
+
### Schema Format:
49
49
Graph Schema:
50
-
- Vertices: [List of vertex labels and their properties]
51
-
- Edges: [List of edge labels, their source and target vertex labels, and properties]
50
+
- "vertices": [List of vertex labels and their properties]
51
+
- "edges": [List of edge labels, their source and target vertex labels, and properties]
52
52
53
-
### Content Rule
54
-
Please read the provided text carefully and identify any information that corresponds to the vertices and edges defined in the schema. For each piece of information that matches a vertex or edge, format it according to the following JSON structures:
53
+
### Content Rule:
54
+
Please read the provided text carefully and identify any information that corresponds to the vertices and edges defined in the schema.
55
+
You are not allowed to modify the schema contraints. Your task is to format the provided information into the required schema, without missing any keyword.
56
+
For each piece of information that matches a vertex or edge, format it strictly according to the following JSON structures:
1. Don't extract property fields or labels that doesn't exist in the given schema. Do not generate new information.
85
+
2. Ensure the extracted property set in the same type as the given schema (like 'age' should be a number, 'select' should be a boolean).
86
+
3. If there are multiple primary keys, the strategy for generating VID is: vertexlabelID:pk1!pk2!pk3 (pk means primary key, and '!' is the separator). This id must be generated ONLY if there are multiple primary keys. If there is only one primary key, the strategy for generating VID is: int (sequencially increasing).
87
+
4. Output in JSON format, only include vertexes and edges & remove empty properties, extracted and formatted based on the text/rules and schema.
88
+
5. Translate the schema fields into Chinese if the given text input is Chinese, even if the given schema is in English. (Optional)
89
+
90
+
Refer to the following baseline example to understand the output generation requirements:
91
+
## Example:
69
92
### Input example:
70
-
#### text
93
+
#### text:
71
94
Meet Sarah, a 30-year-old attorney, and her roommate, James, whom she's shared a home with since 2010. James, in his professional life, works as a journalist.
0 commit comments