Orq MCP is live: Use natural language to interrogate traces, spot regressions, and experiment your way to optimal AI configurations. Available in Claude Desktop, Claude Code, Cursor, and more. Start now →
Connect LlamaIndex to Orq.ai’s AI Router for complete observability, built-in reliability, and access to 300+ LLMs across 20+ providers.
AI Router
Route your LLM calls through the AI Router with a single base URL change. Zero vendor lock-in: always run on the best model at the lowest cost for your use case.
Observability
Instrument your code with OpenTelemetry to capture traces, logs, and metrics for every LLM call, agent step, and tool use.
LlamaIndex is a powerful framework for building RAG (Retrieval-Augmented Generation) applications with LLMs. By connecting LlamaIndex to Orq.ai’s AI Router, you transform experimental RAG applications into production-ready systems with enterprise-grade capabilities.
Here’s a complete example of building a RAG application with LlamaIndex through Orq.ai:
Python
Copy
Ask AI
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settingsfrom llama_index.llms.openai_like import OpenAILikefrom llama_index.embeddings.openai import OpenAIEmbeddingimport os# Configure LLM with Orq.ai AI Routerllm = OpenAILike( model="gpt-4o", api_key=os.getenv("ORQ_API_KEY"), api_base="https://api.orq.ai/v2/router", is_chat_model=True,)# Configure embeddings through Orq.ai (required - LlamaIndex defaults to OpenAI)embed_model = OpenAIEmbedding( model="text-embedding-3-small", api_key=os.getenv("ORQ_API_KEY"), api_base="https://api.orq.ai/v2/router",)# Set as global defaultsSettings.llm = llmSettings.embed_model = embed_model# Load documents and create indexdocuments = SimpleDirectoryReader("./data").load_data()index = VectorStoreIndex.from_documents(documents)# Query the indexquery_engine = index.as_query_engine()response = query_engine.query("What is the main topic of these documents?")print(response)
Integrate LlamaIndex with Orq.ai’s observability to gain comprehensive insights into document indexing, retrieval performance, query processing, and LLM interactions using OpenTelemetry.