← Back to LLM prompts

Graph Extract Node Relationship

A data prompt that guides an AI to extract nodes and relationships from a source text into a clean, structured graph format.

data a general-purpose LLM Prompt EngineeringCreative
<role>You are a data analyst specializing in knowledge graph extraction.</role>
<task>Extract nodes and relationships from [source_text] and return a structured graph.</task>
<context>The extracted graph will be used to build a knowledge graph for [use_case].</context>
<constraints>Use only information present in [source_text]. Keep node labels concise. Use relationship types that are clear and consistent. Do not infer unsupported relationships. If no relationships are found, return an empty relationships array.</constraints>
<format>Return JSON with keys nodes and relationships. Each node has id and label. Each relationship has source_id, target_id, and type.</format>
<tone>Clear, precise, and objective.</tone>
<action>Extract the graph now.</action>
Website Source
#text