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.2.4.tar.gz.

File metadata

File hashes

Hashes for llama_index_indices_managed_vectara-0.2.4.tar.gz
Algorithm Hash digest
SHA256 77e6e98ca73a17f9c62c177e11956bd799e57ecf5541f8ccbdc13c1586e471c6
MD5 d4501f7d66a19af1adeb86997bd0d5ba
BLAKE2b-256 bbf649216445a4d4720c19ee7629e19060fc4b2aea0b6506e2b5e98c1e6fdd02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_indices_managed_vectara-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6fc221500827169a305ff945647885493a4e1760a9b3157e5765bfddae8a4f38
MD5 669011825c9a6c8105300d4c7904cfcf
BLAKE2b-256 8d81e7fc8180e27f54b5ab74668bd5894eb85ead0d7035050415f8dc518e5487

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