Skip to main content

Enterprise-grade Hybrid RAG SDK with optimized knowledge graph traversal and vector search

Project description

VRIN Hybrid RAG SDK v0.2.0

Enterprise-grade Hybrid RAG SDK with optimized knowledge graph traversal and vector search.

🚀 Features

  • Optimized Hybrid RAG - Combines graph knowledge with vector similarity search
  • 🧠 Intelligent Entity Extraction - AI-powered entity recognition and graph traversal
  • 📊 Advanced Fact Extraction - High-confidence fact extraction with scoring
  • 🔍 Sub-2s Query Response - Lightning-fast hybrid retrieval performance
  • 🎯 AI-Powered Summaries - Natural language answers with cited facts
  • 📈 Enterprise-Ready - User isolation, authentication, and production scaling

📦 Installation

pip install vrin

🔧 Quick Start

from vrin import VRINClient

# Initialize with your API key
client = VRINClient(api_key="your_vrin_api_key")

# Insert knowledge with automatic fact extraction
result = client.insert(
    content="Python is a high-level programming language created by Guido van Rossum in 1991. It emphasizes code readability and supports multiple programming paradigms.",
    title="Python Programming Language",
    tags=["programming", "python", "language"]
)

print(f"✅ Extracted {result['facts_extracted']} facts")
# Output: ✅ Extracted 7 facts

# Query with intelligent hybrid search
response = client.query("Who created Python and when?")
print(f"📝 Answer: {response['summary']}")
print(f"⚡ Performance: {response['total_facts']} facts in {response['search_time']}")

# Output: 
# 📝 Answer: Python was created by Guido van Rossum in 1991. It is a high-level programming language known for its simplicity and readability...
# ⚡ Performance: 7 facts in 1.60s

🔍 Advanced Usage

Raw Results Access

# Get detailed graph facts and vector results
details = client.get_raw_results("Python programming language")

print("📊 Graph Facts:")
for fact in details['graph_facts']:
    confidence = fact['confidence']
    print(f"  • {fact['subject']} {fact['predicate']} {fact['object']} (confidence: {confidence:.2f})")

print(f"\n🔎 Vector Chunks: {len(details['vector_results'])}")
print(f"🧠 Entities Found: {details['entities_found']}")

Knowledge Graph Visualization

# Get knowledge graph data for visualization
graph = client.get_knowledge_graph()
print(f"📈 Graph: {len(graph['data']['nodes'])} nodes, {len(graph['data']['edges'])} edges")

Batch Processing

# Insert multiple documents efficiently
documents = [
    {"content": "Machine learning is a subset of AI...", "title": "ML Basics"},
    {"content": "Neural networks consist of layers...", "title": "Neural Networks"},
    {"content": "Deep learning uses multiple layers...", "title": "Deep Learning"}
]

for doc in documents:
    result = client.insert(doc['content'], doc['title'])
    print(f"Processed: {doc['title']} -> {result['facts_extracted']} facts")

🎯 API Reference

VRINClient

__init__(api_key: str)

Initialize the VRIN client with your API key.

insert(content: str, title: str = None, tags: List[str] = None) -> Dict

Insert knowledge into the system with automatic fact extraction.

Returns:

  • success: Whether the operation succeeded
  • facts_extracted: Number of facts extracted
  • chunk_id: Unique identifier for the content
  • message: Status message

query(query: str, include_summary: bool = True, include_raw_results: bool = False) -> Dict

Query the knowledge base with optimized hybrid retrieval.

Parameters:

  • query: Search query string
  • include_summary: Include AI-generated summary (default: True)
  • include_raw_results: Include detailed graph facts and vector results

Returns:

  • success: Whether the query succeeded
  • summary: AI-generated comprehensive answer
  • search_time: Query execution time
  • entities_found: Extracted entities from the query
  • total_facts: Number of graph facts found
  • total_chunks: Number of vector chunks found

get_raw_results(query: str) -> Dict

Get complete raw results including graph facts and vector chunks.

get_knowledge_graph() -> Dict

Get knowledge graph visualization data with nodes and edges.

🔐 Authentication

  1. Sign up at VRIN Console
  2. Create a new API key
  3. Use the API key to initialize your client
client = VRINClient(api_key="vrin_your_api_key_here")

🏗️ Architecture

VRIN uses a sophisticated Hybrid RAG architecture:

  1. Fact Extraction - LLM-powered extraction of structured facts
  2. Graph Storage - Facts stored as a knowledge graph in Neptune
  3. Vector Storage - Semantic embeddings in OpenSearch
  4. Hybrid Retrieval - Combines graph traversal + vector similarity
  5. Result Fusion - Intelligent ranking and result combination
  6. AI Summarization - Natural language response generation

📊 Performance

  • Fact Extraction: ~7-10 facts per 100 words
  • Query Response: Sub-2s for typical queries
  • Confidence Scoring: 0.85-0.95 for high-quality facts
  • Scalability: Handles millions of facts per user

🛠️ Requirements

  • Python 3.8+
  • Active internet connection
  • VRIN API key

📄 License

MIT License - see LICENSE file for details.

🤝 Support


Built with ❤️ by the VRIN Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vrin-0.2.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vrin-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file vrin-0.2.0.tar.gz.

File metadata

  • Download URL: vrin-0.2.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for vrin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f2851f0051ab4ac6d262ee8effbd51ae40ea9a3fad9da1420e56c0659a78f170
MD5 192c6ead1f88854fb108e135cb43d59b
BLAKE2b-256 ac0bc112d288e022b2431d3dfb7c2c3aaf7c606eaa4df3117317ab8469bf5212

See more details on using hashes here.

File details

Details for the file vrin-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vrin-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for vrin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a6a72ff70d2965f9da141099e73282216449aff7eab87a0ea99557d0c169b75
MD5 66b0667b01b973ee7b1213eca555dd50
BLAKE2b-256 91853840c19eb68634dcf2a3664fd1efdd824c2427ee58c6a19221d4d66e3f43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page