Skip to main content

AI Gateway

Overview

LlamaIndex is a powerful framework for building RAG (Retrieval-Augmented Generation) applications with LLMs. Connecting LlamaIndex to Orq.ai’s AI Gateway transforms experimental RAG applications into production-ready systems with enterprise-grade capabilities.

Key Benefits

Orq.ai’s AI Gateway enhances LlamaIndex applications with:

Complete Observability

Track document indexing, retrieval performance, and query processing with detailed traces

Built-in Reliability

Automatic fallbacks, retries, and load balancing for production resilience

Cost Optimization

Real-time cost tracking and spend management across all AI operations

Multi-Provider Access

Access 300+ LLMs and 20+ providers through a single, unified integration

Prerequisites

Before integrating LlamaIndex with Orq.ai, ensure the following are in place:
  • An Orq.ai account and API Key
  • Python 3.8 or higher
  • LlamaIndex installed in your project
To set up an API key, see API keys & Endpoints.

Installation

Install LlamaIndex and required dependencies:

Configuration

Configure LlamaIndex to use Orq.ai’s AI Gateway with the OpenAILike class:
Python
api_base: https://api.orq.ai/v3/router

Basic RAG Example

Here’s a complete example of building a RAG application with LlamaIndex through Orq.ai:
Python

Model Selection

Orq.ai supports any model from 20+ providers:
Python

Streaming Responses

LlamaIndex supports streaming with Orq.ai:
Python