Skip to content

Commit edf8bbb

Browse files
committed
edit extraction prompt
1 parent e197f49 commit edf8bbb

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

src/neo4j_graphrag/generation/prompts.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,20 @@ class SchemaExtractionTemplate(PromptTemplate):
222222
4.5 Do not remove a node type just because you cannot confidently extract any properties for it. If the node type is clearly mentioned in the text, keep it and allow "properties": [].
223223
5. When defining patterns, ensure that every node label and relationship label mentioned exists in your lists of node types and relationship types.
224224
6. Do not create node types that aren't clearly mentioned in the text.
225-
7. Keep your schema minimal and focused on clearly identifiable patterns in the text.
226-
8. UNIQUENESS CONSTRAINTS:
227-
8.1 UNIQUENESS is optional; each node_type may or may not have exactly one uniqueness constraint.
228-
8.2 Only use properties that seem to not have too many missing values in the sample.
229-
8.3 Constraints reference node_types by label and specify which property is unique.
230-
8.4 If a property appears in a uniqueness constraint it MUST also appear in the corresponding node_type as a property.
231-
9. REQUIRED PROPERTIES:
232-
9.1 Mark a property as "required": true if every instance of that node/relationship type MUST have this property (non-nullable).
233-
9.2 Mark a property as "required": false if the property is optional and may be absent on some instances.
234-
9.3 Properties that are identifiers, names, or essential characteristics are typically required.
235-
9.4 Properties that are supplementary information (phone numbers, descriptions, metadata) are typically optional.
236-
9.5 When uncertain, default to "required": false.
237-
9.6 If a property has a UNIQUENESS constraint, it MUST be marked as "required": true.
225+
7. Also model intermediate events or actions (e.g., transactions, encounters, orders, events, reports) as separate node types when they are mentioned.
226+
8. Keep your schema minimal, but do not collapse clearly distinct concepts into a single node type when they are mentioned. Do not default to attaching all information directly to a single subject node; preserve intermediate entities when mentioned.
227+
9. UNIQUENESS CONSTRAINTS:
228+
9.1 UNIQUENESS is optional; each node_type may or may not have exactly one uniqueness constraint.
229+
9.2 Only use properties that seem to not have too many missing values in the sample.
230+
9.3 Constraints reference node_types by label and specify which property is unique.
231+
9.4 If a property appears in a uniqueness constraint it MUST also appear in the corresponding node_type as a property.
232+
10. REQUIRED PROPERTIES:
233+
10.1 Mark a property as "required": true if every instance of that node/relationship type MUST have this property (non-nullable).
234+
10.2 Mark a property as "required": false if the property is optional and may be absent on some instances.
235+
10.3 Properties that are identifiers, names, or essential characteristics are typically required.
236+
10.4 Properties that are supplementary information (phone numbers, descriptions, metadata) are typically optional.
237+
10.5 When uncertain, default to "required": false.
238+
10.6 If a property has a UNIQUENESS constraint, it MUST be marked as "required": true.
238239
239240
Accepted property types are: BOOLEAN, DATE, DURATION, FLOAT, INTEGER, LIST,
240241
LOCAL_DATETIME, LOCAL_TIME, POINT, STRING, ZONED_DATETIME, ZONED_TIME.

0 commit comments

Comments
 (0)