Skip to main content

LlamaIndex Managed Integration: Vectara

The Vectara Index provides a simple implementation to Vectara's end-to-end RAG pipeline, including data ingestion, document retrieval, reranking results, summary generation, and hallucination evaluation.

Please note that this documentation applies to versions >= 0.4.0 and will not be the same as for earlier versions of Vectara ManagedIndex.

📌 Setup

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

pip install -U llama-index

Next, install the Vectara Index:

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

Finally, set up your Vectara corpus. If you don't have a Vectara account, you can sign up and follow our Quick Start guide to create a corpus and an API key (make sure the api_key has both indexing and query permissions, or use your personal API key).

Once you have your API key, export it as an environment variable:

import os

os.environ["VECTARA_API_KEY"] = "<YOUR_VECTARA_API_KEY>"
os.environ["VECTARA_CORPUS_KEY"] = "<YOUR_VECTARA_CORPUS_KEY>"

🚀 Usage

1. Index Documents

Create an index and add some sample documents:

from llama_index.indices.managed.vectara import VectaraIndex
from llama_index.core.schema import Document, MediaResource

docs = [
    Document(
        id_="doc1",
        text_resource=MediaResource(
            text="""
            This is test text for Vectara integration with LlamaIndex.
            Users should love their experience with this integration
            """,
        ),
    ),
    Document(
        id_="doc2",
        text_resource=MediaResource(
            text="""
            The Vectara index integration with LlamaIndex implements Vectara's RAG pipeline.
            It can be used both as a retriever and query engine.
            """,
        ),
    ),
]
index = VectaraIndex.from_documents(docs)

Make sure to always specify a unique id_ for every document you add to your index. If you don't specify this parameter, a random id will be generated and the document will be separately added to your corpus every time you run your code.

You can now use this index to retrieve documents.

2. Retrieve Documents

Retrieve the top 2 most relevant document for a query:

# Retrieves the top search result
retriever = index.as_retriever(similarity_top_k=2)

results = retriever.retrieve("How will users feel about this new tool?")
print(results[0])

3. Use as a Query Engine

Generate a summary of retrieved results:

query_engine = index.as_query_engine()

results = query_engine.query(
    "Which company has partnered with Vectara to implement their RAG pipeline as an index?"
)
print(f"Generated summary: {results.response}\n")
print("Top sources:")
for node in results.source_nodes[:2]:
    print(node)

📂 Understanding source_nodes structure

Each node object in source_nodes contains a NodeWithScore object with:

  • text: The matched text snippet.
  • id_: The unique identifier of the document.
  • metadata: A dictionary containing:
    • Key-value pairs from the matched part of the document.
    • A document key that stores all document-level metadata.
  • score: The relevance score of the match.

Example Output:

NodeWithScore(
    node=Node(
        text_resource=MediaResource(
            text="This is a test text for Vectara integration with LlamaIndex."
        ),
        id_="doc1",
        metadata={
            "category": "AI",
            "page": 23,
            "document": {
                "url": "https://www.vectara.com/developers/build/integrations/llamaindex",
                "title": "LlamaIndex + Vectara Integration",
                "author": "Ofer Mendelevitch",
                "date": "2025-03-01"
            }
        }
    ),
    score=0.89
)

If you want to see the full features and capabilities of VectaraIndex, check out this Jupyter notebook.

Metadata

Release files for llama-index-indices-managed-vectara 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-indices-managed-vectara 0.8.0
File Size Uploaded Provenance Actions
llama_index_indices_managed_vectara-0.8.0.tar.gz 17.9 kB Without provenance Details for llama_index_indices_managed_vectara-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-indices-managed-vectara 0.8.0
File Interpreter ABI Platform Actions
llama_index_indices_managed_vectara-0.8.0-py3-none-any.whl Python 3 none any Details for llama_index_indices_managed_vectara-0.8.0-py3-none-any.whl

Total release size: 37.4 kB

Release files / llama_index_indices_managed_vectara-0.8.0.tar.gz

Download URL llama_index_indices_managed_vectara-0.8.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
132d785ab599695a26d22312eb0b1c17fb2abd0b6671be50c14933e5b2777a88
BLAKE2b-256 checksum
How to use checksums
f2dde6bdfb890296fdf5646f9e353787d59e475d93244477659a4ad37425e86e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_indices_managed_vectara-0.8.0-py3-none-any.whl

Download URL llama_index_indices_managed_vectara-0.8.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1668757c899506136dafa5de676adc3cbad260a81a01be1150c62785f4870d5
BLAKE2b-256 checksum
How to use checksums
3d92f2211a8b46efd06e1d749b6f48f23b66cb21bdfca97e1cd5feb17a73fde5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-indices-managed-vectara 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page