Skip to main content

llama-index indices llama-cloud integration

Project description

LlamaCloud Index + Retriever

LlamaCloud is a new generation of managed parsing, ingestion, and retrieval services, designed to bring production-grade context-augmentation to your LLM and RAG applications.

Currently, LlamaCloud supports

  • Managed Ingestion API, handling parsing and document management
  • Managed Retrieval API, configuring optimal retrieval for your RAG system

Access

We are opening up a private beta to a limited set of enterprise partners for the managed ingestion and retrieval API. If you’re interested in centralizing your data pipelines and spending more time working on your actual RAG use cases, come talk to us.

If you have access to LlamaCloud, you can visit LlamaCloud to sign in and get an API key.

Setup

First, make sure you have the latest LlamaIndex version installed.

NOTE: If you are upgrading from v0.9.X, we recommend following our migration guide, as well as uninstalling your previous version first.

pip uninstall llama-index  # run this if upgrading from v0.9.x or older
pip install -U llama-index --upgrade --no-cache-dir --force-reinstall

The llama-index-indices-managed-llama-cloud package is included with the above install, but you can also install directly

pip install -U llama-index-indices-managed-llama-cloud

Usage

You can create an index on LlamaCloud using the following code:

import os

os.environ[
    "LLAMA_CLOUD_API_KEY"
] = "llx-..."  # can provide API-key in env or in the constructor later on

from llama_index.core import SimpleDirectoryReader
from llama_index.indices.managed.llama_cloud import LlamaCloudIndex

# create a new index
index = LlamaCloudIndex.from_documents(
    documents,
    "my_first_index",
    project_name="default",
    api_key="llx-...",
    verbose=True,
)

# connect to an existing index
index = LlamaCloudIndex("my_first_index", project_name="default")

You can also configure a retriever for managed retrieval:

# from the existing index
index.as_retriever()

# from scratch
from llama_index.indices.managed.llama_cloud import LlamaCloudRetriever

retriever = LlamaCloudRetriever("my_first_index", project_name="default")

And of course, you can use other index shortcuts to get use out of your new managed index:

query_engine = index.as_query_engine(llm=llm)

chat_engine = index.as_chat_engine(llm=llm)

Retriever Settings

A full list of retriever settings/kwargs is below:

  • dense_similarity_top_k: Optional[int] -- If greater than 0, retrieve k nodes using dense retrieval
  • sparse_similarity_top_k: Optional[int] -- If greater than 0, retrieve k nodes using sparse retrieval
  • enable_reranking: Optional[bool] -- Whether to enable reranking or not. Sacrifices some speed for accuracy
  • rerank_top_n: Optional[int] -- The number of nodes to return after reranking initial retrieval results
  • alpha Optional[float] -- The weighting between dense and sparse retrieval. 1 = Full dense retrieval, 0 = Full sparse retrieval.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file llama_index_indices_managed_llama_cloud-0.5.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_indices_managed_llama_cloud-0.5.0.tar.gz
Algorithm Hash digest
SHA256 09fc44d8537a7c4fe041900705d708295bc2c8432de4caea5d149d6a4777edf5
MD5 1dabf6263d9b96e2e06834fc193f981f
BLAKE2b-256 3c626e13fbe4d68f8605f8c2fe07c04933657ddcc64e59b8087522d066c5618f

See more details on using hashes here.

File details

Details for the file llama_index_indices_managed_llama_cloud-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_indices_managed_llama_cloud-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bd57854f0c08412d312b86f253bb8ac2a7cf62d4631d049b1204d57da52a2a7
MD5 047c85baf930d708f025033dc8149983
BLAKE2b-256 4b1b09b19c1d0c501ceafbb2acfaa8c34c4e1a13fcc87ea95afc258e8657e535

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page