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.2.0.tar.gz (563.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.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llamaindex_omega-0.2.0.tar.gz
Algorithm Hash digest
SHA256 89abd0aa1c556bc7bc15de29e6f6c1441fd069cc6eb5f4cbf2389650e1e24c26
MD5 484aab19cb23f352ba0a33a220eeb3a3
BLAKE2b-256 1f25281ca539562b283cc598662481659bebfadcc3eb0f36a44bb6d4ebfdfd76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llamaindex_omega-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56fa93ef7422957f20ae657fe0b4b5974a59ec468d79455047180e599cb1303b
MD5 157a95100f9765f807fd5ed79c807887
BLAKE2b-256 130fc7f66621209b738592f3507156bc8b497ace53ec04ff87597bb855c5dd0f

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