Skip to main content

LlamaIndex integration with OmegaEngine governance - RAG safety and compliance

Project description

OmegaEngine Logo

llamaindex-omega

LlamaIndex Integration for OmegaEngine

PyPI CI License

DocumentationPlaygroundIssues


✨ Features

  • 🔗 Query Engine Wrapper — Add governance to any LlamaIndex query
  • 📊 Retrieval Guard — Validate retrieved context before synthesis
  • 🛡️ Response Validator — Check LLM outputs against policies
  • 📈 Observability — Full audit trail for RAG pipelines
  • Async Support — Native async/await compatibility

📦 Installation

pip install llamaindex-omega

🚀 Quick Start

Governed Query Engine

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llamaindex_omega import GovernedQueryEngine

# Load your documents
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)

# Wrap with OmegaEngine governance
query_engine = GovernedQueryEngine(
    index.as_query_engine(),
    api_key="your-omega-api-key",
    policy_id="rag_policy",
)

# All queries are now governed
response = query_engine.query("What are the quarterly results?")
print(response)

Response Callback

from llamaindex_omega import OmegaCallbackHandler

callback = OmegaCallbackHandler(
    api_key="your-omega-api-key",
    log_retrievals=True,
    log_responses=True,
)

# Attach to your service context
from llama_index.core import Settings
Settings.callback_manager.add_handler(callback)

🛡️ Retrieval Guard

Validate retrieved context before it's sent to the LLM:

from llamaindex_omega import GovernedRetriever

guard = GovernedRetriever(
    api_key="your-omega-api-key",
    block_pii=True,
    block_sensitive_topics=["financial", "medical"],
)

# Wrap your retriever
safe_retriever = guard.wrap(index.as_retriever())

# Retrieved nodes are validated before synthesis
nodes = safe_retriever.retrieve("Tell me about the patient")

📊 Audit Trail

Every query is logged with:

  • ✅ Original query
  • ✅ Retrieved context (optionally)
  • ✅ Generated response
  • ✅ Policy evaluation result
  • ✅ Risk score
  • ✅ Latency metrics
# Access audit data
print(response.metadata["omega_audit_id"])
print(response.metadata["omega_decision"])

🔌 Works With All LlamaIndex Features

  • ✅ VectorStoreIndex
  • ✅ KnowledgeGraphIndex
  • ✅ DocumentSummaryIndex
  • ✅ Chat Engine
  • ✅ Agents
  • ✅ SubQuestionQueryEngine

📄 License

Licensed under the Apache License 2.0.


Built with ❤️ by the OmegaEngine 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

llamaindex_omega-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file llamaindex_omega-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llamaindex_omega-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f09421af8641ff4ce6391148fc316396c8202b82b02fcd62e97a5648a4b52b16
MD5 22d888454453d632c97694b3ed98b1e0
BLAKE2b-256 2f5f4906eab6f7ccb9b51b35b773f0a2ab54a9c5981c110de4c223962a19767a

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