Skip to main content

Installation

LlamaIndex.TS is designed to work across multiple JavaScript runtime environments. This guide covers installation for all supported runtimes and package managers.

Quick Install

For most Node.js projects, start with:
The llamaindex package provides core functionality. You’ll also need to install provider packages for LLMs, embeddings, and vector stores.

Runtime Requirements

LlamaIndex.TS supports multiple JavaScript runtimes with different requirements:
Browser support is currently limited due to the lack of AsyncLocalStorage-like APIs. Use edge runtimes for serverless deployments.

Provider Packages

LlamaIndex.TS uses a modular architecture. Install only the providers you need to keep your bundle size small.

LLM Providers

Choose the LLM provider(s) you want to use:
Supports GPT-4, GPT-3.5, and OpenAI embeddings.

Vector Store Providers

For production use, integrate with a vector database:

Runtime-Specific Setup

Node.js

Node.js >= 20 is required for full AsyncLocalStorage support.
Standard installation works out of the box:

Deno

LlamaIndex.TS works with Deno’s npm compatibility:

Bun

Bun has full support with its fast package manager:
Then use normally:

Vercel Edge Runtime

For Vercel Edge Functions, use the edge-compatible entry point:
Some features that require file system access may be limited in edge environments. Use remote vector stores for data persistence.

Cloudflare Workers

Cloudflare Workers automatically use the workerd-compatible entry point:

Environment Variables

Set up your API keys and configuration:
.env
Use a .env file for local development and configure environment variables in your deployment platform for production.

Additional Packages

Workflow and Agents

For building agentic applications:

File Readers

For reading different file formats:

LlamaCloud

For managed RAG with LlamaCloud:

Verifying Installation

Create a simple test file to verify everything works:
test.ts
Run it:
If you see “Installation successful!”, you’re ready to go!

Troubleshooting

Module Resolution Errors

If you encounter module resolution errors, ensure you’re using Node.js >= 20:

TypeScript Configuration

Add these settings to your tsconfig.json:
tsconfig.json

API Key Issues

If your API key isn’t being recognized:
  1. Ensure .env is in your project root
  2. Install dotenv and load it:
  3. Verify the key is set:

Next Steps

Quickstart

Build your first RAG application

Core Concepts

Learn about Documents, Nodes, and Indices