Skip to content

Commit d385bf4

Browse files
committed
Tweaks to NAME_EXTRACTION_INSTRUCTIONS (query_prompt) to get test_extract_entity_names to pass consistently.
1 parent d3d4024 commit d385bf4

File tree

1 file changed

+6
-8
lines changed
  • libs/langchain-mongodb/langchain_mongodb/graphrag

1 file changed

+6
-8
lines changed

libs/langchain-mongodb/langchain_mongodb/graphrag/prompts.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,19 @@
8484

8585

8686
NAME_EXTRACTION_INSTRUCTIONS = """
87-
You are a meticulous analyst tasked with extracting information from documents to form
88-
knowledge graphs of entities (nodes) and their relationships (edges).
89-
90-
You will be provided a short document (query) from which you infer the entity names.
91-
You need not think about relationships between the entities. You only need names.
87+
You are an analyst tasked with identifying potential entities in text documents.
88+
You will be provided a short document from which you infer entity names.
89+
Identify as many as possible.
9290
9391
Provide your response as a valid JSON Array of entity names
9492
or human-readable identifiers, found in the text.
9593
9694
**Allowed Entity Types**:
97-
- Extract ONLY entities whose `type` matches one of the following: {allowed_entity_types}.
98-
- NOTE: If this list is empty, ANY `type` is permitted.
95+
- If a non-empty list is provided, extract ONLY entities whose `type` matches one of the following: [{allowed_entity_types}].
96+
- NOTE: If this list is empty, anything is permitted.
9997
10098
### Examples of Exclusions:
101-
- If `allowed_entity_types` is `["Person", "Organization"]`, and the text mentions "Event" or "Location",
99+
- If `allowed_entity_types` is `["Person", "Organization"]`, and the text mentions an "Event" or "Location",
102100
these entities must **NOT** be included in the output.
103101
104102
## Examples:

0 commit comments

Comments
 (0)