Created
March 24, 2024 03:53
-
-
Save ibuildthecloud/fd689b7f153a3151f277ed57fe8d0af5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tools: sys.http.html2text | |
json: true | |
Download the wikipedia article for "Walt Disney" and then process the output according to the following rules | |
# Knowledge Graph Instructions for GPT-4 | |
## 1. Overview | |
You are a top-tier algorithm designed for extracting information in structured formats to build a knowledge graph. | |
- **Nodes** represent entities and concepts. They're akin to Wikipedia nodes. | |
- The aim is to achieve simplicity and clarity in the knowledge graph, making it accessible for a vast audience. | |
## 2. Labeling Nodes | |
- **Consistency**: Ensure you use basic or elementary types for node labels. | |
- For example, when you identify an entity representing a person, always label it as **"person"**. Avoid using more specific terms like "mathematician" or "scientist". | |
- **Node IDs**: Never utilize integers as node IDs. Node IDs should be names or human-readable identifiers found in the text. | |
## 3. Handling Numerical Data and Dates | |
- Numerical data, like age or other related information, should be incorporated as attributes or properties of the respective nodes. | |
- **No Separate Nodes for Dates/Numbers**: Do not create separate nodes for dates or numerical values. Always attach them as attributes or properties of nodes. | |
- **Property Format**: Properties must be in a key-value format. | |
- **Quotation Marks**: Never use escaped single or double quotes within property values. | |
- **Naming Convention**: Use camelCase for property keys, e.g., `birthDate`. | |
## 4. Coreference Resolution | |
- **Maintain Entity Consistency**: When extracting entities, it's vital to ensure consistency. | |
If an entity, such as "John Doe", is mentioned multiple times in the text but is referred to by different names or pronouns (e.g., "Joe", "he"), | |
always use the most complete identifier for that entity throughout the knowledge graph. In this example, use "John Doe" as the entity ID. | |
Remember, the knowledge graph should be coherent and easily understandable, so maintaining consistency in entity references is crucial. | |
## 5. Strict Compliance | |
Adhere to the rules strictly. Non-compliance will result in termination. | |
## 6. Output Format | |
Structure the output to look like | |
```json | |
{ | |
"nodes": [ | |
{ | |
id: "node id" | |
properties: [ | |
{ | |
key: "property key", | |
value: "property value" | |
} | |
] | |
} | |
], | |
"relationships": [ | |
{ | |
id: "relationship id" | |
sourceNodeId: "source node id", | |
targetNodeId: "target node id", | |
relationshipType: "relationshipType", | |
properties: [ | |
{ | |
key: "property key", | |
value: "property value" | |
} | |
] | |
} | |
] | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Each time you run this you will get a different output. The first time I ran it I got