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 Distribution

llamaindex_omega-0.3.0.tar.gz (564.5 kB view details)

Uploaded Source

Built Distribution

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

llamaindex_omega-0.3.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file llamaindex_omega-0.3.0.tar.gz.

File metadata

  • Download URL: llamaindex_omega-0.3.0.tar.gz
  • Upload date:
  • Size: 564.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for llamaindex_omega-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5155834b39c603932764301b22befb236b9afcdc4767604c4f0b37b68a36b9d7
MD5 e919df61f8259dec7e32dfd232a2f2be
BLAKE2b-256 b6861f4e6732c6dd8318cfc0714fe37658f5865d4e0626eed2f5f8c8a6d2f9f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llamaindex_omega-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7780eacc02f04fd7f6b1b8ef7f3002a32353b2eb1e4efeceeb7b33760d073bbe
MD5 84169e8b536944ee5a705c6f50ef6571
BLAKE2b-256 56b82508d9e408a045eee30fccdef86ab2ce398901d0161a11ca4636f2d11890

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