Type something to search...
Llama Index

Llama Index

Llama Index

31.3k 4.3k
03 May, 2024

What is LlamaIndex ?

LlamaIndex is a data framework for LLM-based applications to ingest, structure, and access private or domain-specific data. It’s available in Python (these docs) and Typescript.

Why LlamaIndex?

LLMs offer a natural language interface between humans and data. Widely available models come pre-trained on huge amounts of publicly available data like Wikipedia, mailing lists, textbooks, source code and more.

However, while LLMs are trained on a great deal of data, they are not trained on your data, which may be private or specific to the problem you’re trying to solve. It’s behind APIs, in SQL databases, or trapped in PDFs and slide decks.

You may choose to fine-tune a LLM with your data, but:

  • Training a LLM is expensive.

  • Due to the cost to train, it’s hard to update a LLM with latest information.

  • Observability is lacking. When you ask a LLM a question, it’s not obvious how the LLM arrived at its answer.

LlamaIndex takes a different approach called Retrieval-Augmented Generation (RAG). Instead of asking LLM to generate an answer immediately, LlamaIndex:

  • retrieves information from your data sources first,

  • adds it to your question as context, and

  • asks the LLM to answer based on the enriched prompt.

RAG overcomes all three weaknesses of the fine-tuning approach:

  • There’s no training involved, so it’s cheap.

  • Data is fetched only when you ask for them, so it’s always up to date.

  • LlamaIndex can show you the retrieved documents, so it’s more trustworthy.

LlamaIndex imposes no restriction on how you use LLMs. You can still use LLMs as auto-complete, chatbots, semi-autonomous agents, and more (see Use Cases on the left). It only makes LLMs more relevant to you.

How can LlamaIndex help?

LlamaIndex provides the following tools:

  • Data connectors ingest your existing data from their native source and format. These could be APIs, PDFs, SQL, and (much) more.

  • Data indexes structure your data in intermediate representations that are easy and performant for LLMs to consume.

  • Engines provide natural language access to your data. For example:

  • Query engines are powerful retrieval interfaces for knowledge-augmented output.

  • Chat engines are conversational interfaces for multi-message, “back and forth” interactions with your data.

  • Data agents are LLM-powered knowledge workers augmented by tools, from simple helper functions to API integrations and more.

  • Application integrations tie LlamaIndex back into the rest of your ecosystem. This could be LangChain, Flask, Docker, ChatGPT, or… anything else!

Who is LlamaIndex for?

LlamaIndex provides tools for beginners, advanced users, and everyone in between.

Our high-level API allows beginner users to use LlamaIndex to ingest and query their data in 5 lines of code.

For more complex applications, our lower-level APIs allow advanced users to customize and extend any module—data connectors, indices, retrievers, query engines, reranking modules—to fit their needs.

Install Llama Index

To install the library:

Terminal window
pip install llama-index