Skip to main content

llama-index managed vectara integration

Project description

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.

Setup

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

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 it has both indexing and query permissions).

Usage

First let's initialize the index with some sample documents.

import os

os.environ["VECTARA_API_KEY"] = "<YOUR_VECTARA_API_KEY>"
os.environ["VECTARA_CORPUS_ID"] = "<YOUR_VECTARA_CORPUS_ID>"
os.environ["VECTARA_CUSTOMER_ID"] = "<YOUR_VECTARA_CUSTOMER_ID>"

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

docs = [
    Document(
        text="""
        This is test text for Vectara integration with LlamaIndex.
        Users should love their experience with this integration
        """,
    ),
    Document(
        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)

You can now use this index to retrieve documents.

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

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

You can also use it as a query engine to get a generated summary from the 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)

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

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_vectara-0.3.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_indices_managed_vectara-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3320c33428dcbafc40850e4292bc0e4a12b0689095163ef1bb4eef57038eea44
MD5 60b3f447f77e2ddfc81449559222d93f
BLAKE2b-256 f922ac171c9c8e8c6d95a78314048e3e9341991221101b780659e3c04bf3638b

See more details on using hashes here.

File details

Details for the file llama_index_indices_managed_vectara-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_indices_managed_vectara-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed544d2363be88673fdf48ab353025a5cfb5362f3046b2ffed9d1131a990042a
MD5 4d77f16b9c5fcf0fe513e7c22206dec5
BLAKE2b-256 3fa1d3f38284cdcc9df65e0b8f221ee2bdfa61be2a2f7a5f3931c788ad9cbe8c

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