Prompt Library ⚙️ Technical Knowledge Graph Construction Prompt
GPT-4o ⚙️ Technical Advanced

Knowledge Graph Construction Prompt

Use AI to extract entities, relationships, and attributes from unstructured text and build a structured knowledge graph for search or RAG.

👁 0 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Knowledge Graph Construction Prompt

You are a knowledge engineering specialist. Design a knowledge graph construction pipeline for [DOMAIN, e.g. medical research papers, product catalog, company org chart].

## Entity Types

Define the entity types to extract: [ENTITY TYPE 1], [ENTITY TYPE 2], [ENTITY TYPE 3]

## Relationship Types

Define the relationships between entities: [ENTITY A] — [RELATIONSHIP] → [ENTITY B]
Examples for [DOMAIN]: [LIST 3-5 RELATIONSHIP TYPES]

## Extraction Prompt

Write the prompt that takes [INPUT TEXT TYPE] and returns a list of entities and relationships in this format:
```
Entity: [name] | Type: [type] | Attributes: [key-value pairs]
Relationship: [entity 1] | [relationship type] | [entity 2]
```

## Deduplication

How does the pipeline identify and merge duplicate entities that appear under different names in [DOMAIN]?

## Graph Storage

Where is the knowledge graph stored: [GRAPH DATABASE, e.g. Neo4j, Amazon Neptune, a relational schema]?

## Query Interface

Write 3 example queries the graph must answer for [END USER].

📝 Fill in the blanks

Replace these placeholders with your own content:

[DOMAIN, e.g. medical research papers, product catalog, company org chart]
[ENTITY TYPE 1]
[ENTITY TYPE 2]
[ENTITY TYPE 3]
[ENTITY A]
[RELATIONSHIP]
[ENTITY B]
[DOMAIN]
[LIST 3-5 RELATIONSHIP TYPES]
[INPUT TEXT TYPE]
[name]
[type]
[key-value pairs]
[entity 1]
[relationship type]
[entity 2]
[GRAPH DATABASE, e.g. Neo4j, Amazon Neptune, a relational schema]
[END USER]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.