Integrate Vectara for RAG and Summarization
End-to-end Retrieval Augmented Generation pack for LlamaIndex using Vectara, with hybrid search, reranking options (MMR, multilingual_reranker_v1, chain), and
Why it matters
Leverage Vectara's advanced retrieval and summarization capabilities to build powerful RAG applications. Ingest data, perform hybrid searches, and generate concise summaries from your knowledge base.
Outcomes
What it gets done
Set up end-to-end Retrieval Augmented Generation (RAG) flows with Vectara.
Index documents into a Vectara corpus for efficient retrieval.
Configure hybrid search parameters for optimal query results.
Generate summaries from retrieved information with customizable language and length.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-pack-packs-vectara-rag | bash Steps
Steps in the chain
Sign up for a Vectara account at https://vectara.com/integrations/llamaindex and follow the Quick Start guide to create a corpus and an API key with both indexing and query permissions. Configure environment variables VECTARA_CORPUS_KEY and VECTARA_API_KEY or provide them when initializing VectaraIndex.
Use llamaindex-cli to download the Vectara llamapack: llamaindex-cli download-llamapack VectaraRagPack --download-dir ./vectara_rag_pack. Inspect the files and use them as a template for your project.
Download the pack to a ./vectara_rag_pack directory using: from llama_index.core.llama_pack import download_llama_pack; VectaraRAG = download_llama_pack('VectaraRagPack', './vectara_rag_pack')
If you want to ingest documents into the Vectara Corpus, initialize with nodes: nodes = [...]; vectara = VectaraRAG(nodes=nodes)
If you already indexed data on Vectara and only want retrieval/query functionality, initialize without arguments: vectara = VectaraRAG()
Set optional arguments like similarity_top_k, lambda_val, n_sentences_before/after, reranker, rerank_k, mmr_diversity_bias, summary_enabled, summary_response_lang, summary_num_results, and summary_prompt_name to customize the RAG behavior.
Call the retrieve method to get nodes: nodes = vectara.retrieve('Is light a wave or a particle?')
Query with Vectara summarization: response = vectara._query_engine.query('Is light a wave or a particle?').response or use the run() wrapper: response = vectara.run('Is light a wave or a particle?').response
Overview
Vectara RAG Pack
What it does
A LlamaPack that implements Retrieval Augmented Generation using Vectara's platform, supporting document ingestion, retrieval, reranking, and summarization capabilities.
How it connects
Use this pack when you need to build RAG workflows with Vectara, whether ingesting new documents into a corpus or querying existing indexed data with configurable retrieval and summarization options.
Source README
Description pending for li-pack-packs-vectara-rag.
Step 1: Set up Vectara account and credentials
Sign up for a Vectara account at https://vectara.com/integrations/llamaindex and follow the Quick Start guide to create a corpus and an API key with both indexing and query permissions. Configure environment variables VECTARA_CORPUS_KEY and VECTARA_API_KEY or provide them when initializing VectaraIndex.
Step 2: Download VectaraRagPack using CLI
Use llamaindex-cli to download the Vectara llamapack: llamaindex-cli download-llamapack VectaraRagPack --download-dir ./vectara_rag_pack. Inspect the files and use them as a template for your project.
Step 3: Download pack programmatically
Download the pack to a ./vectara_rag_pack directory using: from llama_index.core.llama_pack import download_llama_pack; VectaraRAG = download_llama_pack('VectaraRagPack', './vectara_rag_pack')Step 4: Initialize VectaraRAG with documents
If you want to ingest documents into the Vectara Corpus, initialize with nodes: nodes = [...]; vectara = VectaraRAG(nodes=nodes)
Step 5: Initialize VectaraRAG for existing data
If you already indexed data on Vectara and only want retrieval/query functionality, initialize without arguments: vectara = VectaraRAG()
Step 6: Configure optional parameters
Set optional arguments like similarity_top_k, lambda_val, n_sentences_before/after, reranker, rerank_k, mmr_diversity_bias, summary_enabled, summary_response_lang, summary_num_results, and summary_prompt_name to customize the RAG behavior.
Step 7: Use as retriever
Call the retrieve method to get nodes: nodes = vectara.retrieve('Is light a wave or a particle?')Step 8: Use as query engine
Query with Vectara summarization: response = vectara._query_engine.query('Is light a wave or a particle?').response or use the run() wrapper: response = vectara.run('Is light a wave or a particle?').responseDiscussion
Questions & comments · 0
Sign In Sign in to leave a comment.