Add semantic graph modeling support for Qdrant vector database with automatic entity extraction#1
Add semantic graph modeling support for Qdrant vector database with automatic entity extraction#1
Conversation
Co-authored-by: gtonic <3163718+gtonic@users.noreply.github.com>
Co-authored-by: gtonic <3163718+gtonic@users.noreply.github.com>
Co-authored-by: gtonic <3163718+gtonic@users.noreply.github.com>
|
Awesome @copilot ! Can you tell me how I could automatically detect/infer the entity and its relations from my data in an automatic way so that I do not need to specify it specifically? EntityID: "person-john-doe", |
Co-authored-by: gtonic <3163718+gtonic@users.noreply.github.com>
Great question! I've added automatic entity and relationship extraction so you don't need to manually specify EntityID, EntityType, or Relations. Quick AnswerUse the new extractor := entity.NewExtractor(completer, embedder)
entities, err := extractor.ExtractFromText(ctx, yourText)
// All entities and relationships extracted automatically!How It WorksThe LLM automatically:
ExampleInput text: Automatically extracts:
Files Added
See the documentation for more details on LLM-based, NLP-based, and hybrid approaches! Commit: dba98c6 (updated with automatic extraction) |
Co-authored-by: gtonic <3163718+gtonic@users.noreply.github.com>
This PR provides a complete implementation and documentation for modeling semantic graphs in Qdrant vector database, answering the question: "How could I apply data extraction to Qdrant vector DB to model a semantic graph (where entities have relations to each other) while keeping the data at the leafs in vector form?"
Overview
Yes, it is absolutely possible! This implementation demonstrates how to combine vector embeddings for semantic content with relationship metadata for graph structure, all within a single Qdrant collection.
Key Features
🔗 Graph Extensions to Index Interface
GraphDocument- Extends the baseDocumenttype with entity ID, type, and relationshipsGraphProvider- Interface for graph operations including:IndexEntity()- Store entities with relationshipsQueryRelated()- Find entities by relationship typeQueryGraph()- Hybrid semantic + graph queriesTraverseGraph()- Multi-hop graph navigationRelation- Typed edges between entities with optional metadata🤖 Automatic Entity Extraction
NEW: Automatic entity and relationship extraction using LLMs eliminates the need to manually specify EntityID, EntityType, and Relations:
The automatic extractor:
🗄️ Qdrant Reference Implementation
A complete reference implementation in
pkg/index/qdrant/client.gothat:📊 Architecture
Query Capabilities
Example Usage
Manual Entity Creation
Automatic Entity Extraction
Hybrid Query
Documentation
Comprehensive documentation includes:
Working Examples
Manual Graph Example
examples/semantic-graph/demonstrates:Automatic Extraction Example
NEW:
examples/auto-extraction/demonstrates:Benefits
✅ Best of both worlds - Vector semantics + graph structure
✅ Automatic extraction - No manual entity specification needed
✅ Single database - No separate graph database needed
✅ Scalable - Handles millions of entities efficiently
✅ Flexible - Add relationship types without schema changes
✅ Fast queries - HNSW for vectors + indexed payloads for metadata
✅ Integrates seamlessly - Works with existing Wingman extractors and embedders
Use Cases
This implementation opens up powerful possibilities for knowledge representation and retrieval by combining the semantic understanding of vector embeddings with the structural expressiveness of graph relationships, now with automatic entity extraction capabilities for zero-touch graph building.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.