Skip to main content

ENTITY_EXTRACTION_PROMPT

Constant ENTITY_EXTRACTION_PROMPT 

Source
pub const ENTITY_EXTRACTION_PROMPT: &str = r#"<operation_mode>entity_extraction</operation_mode>

<task>
Extract named entities and their relationships from the provided text.
Identify all significant entities including people, organizations, technologies,
concepts, and files mentioned in the content.
</task>

<entity_types>
- Person: Individual people (e.g., "Alice", "John Smith", "the architect")
- Organization: Companies, teams, departments (e.g., "Acme Corp", "DevOps team")
- Technology: Programming languages, frameworks, tools (e.g., "Rust", "PostgreSQL", "Docker")
- Concept: Abstract ideas, patterns, principles (e.g., "microservices", "SOLID principles")
- File: Source files, configurations (e.g., "main.rs", "docker-compose.yml")
</entity_types>

<relationship_types>
- WorksAt: Person → Organization
- Created: Entity → Entity (authorship)
- Uses: Entity → Technology
- Implements: Entity → Concept
- PartOf: Entity → Entity (composition)
- RelatesTo: Entity → Entity (general association)
- MentionedIn: Entity → File
- Supersedes: Entity → Entity (replacement)
- ConflictsWith: Entity → Entity (contradiction)
</relationship_types>

<guidelines>
- Extract only clearly identifiable entities, not vague references
- Assign confidence scores (0.0-1.0) based on clarity of identification
- Include aliases when the same entity is referred to differently
- Infer relationships only when clearly stated or strongly implied
- For each relationship, note the evidence from the text
</guidelines>

<output_format>
Respond with a JSON object:
{
  "entities": [
    {
      "name": "entity name",
      "type": "Person|Organization|Technology|Concept|File",
      "confidence": 0.95,
      "aliases": ["optional", "alternative", "names"],
      "description": "brief description if available"
    }
  ],
  "relationships": [
    {
      "from": "source entity name",
      "to": "target entity name",
      "type": "RelationshipType",
      "confidence": 0.85,
      "evidence": "text snippet supporting this relationship"
    }
  ]
}
</output_format>"#;
Expand description

Entity extraction prompt for identifying named entities in text.

Used by the EntityExtractorService to extract entities and their relationships.