Nyraxis AI

LlamaIndex

Add governance to LlamaIndex RAG pipelines and agents.

LlamaIndex Integration

Setup

import nyraxis_sdk
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.llms.openai import OpenAI

nyraxis_sdk.init(
    api_key="nyx_...",
    enforce=True,
    instrument=True,
    agent_name="rag-pipeline",
)

RAG query engine

documents = SimpleDirectoryReader("./data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine(llm=OpenAI(model="gpt-4o"))

# Nyraxis evaluates the user query before it reaches the LLM
response = query_engine.query("What is the refund policy?")

With hallucination detection

Nyraxis can compare the LLM output against the retrieved context to detect hallucination:

# Enable hallucination policy in your dashboard
# It automatically compares output vs retrieved chunks

response = query_engine.query(user_question)
# If the LLM invents facts not in the retrieved documents → violation logged

Chat engine

chat_engine = index.as_chat_engine(
    chat_mode="condense_plus_context",
    llm=OpenAI(model="gpt-4o"),
)

response = chat_engine.chat("Tell me about pricing")
# Every turn is evaluated for PII, injection, toxicity, etc.

What gets traced

  • User queries
  • Retrieved document chunks
  • LLM prompts (with context)
  • Final responses
  • Embedding calls

All visible in your Nyraxis dashboard with full RAG metadata.

On this page