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
Release history Release notifications | RSS feed
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.1.tar.gz
.
File metadata
- Download URL: llama_index_indices_managed_vectara-0.2.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 930f2791084d2fdd8fcb4b8581acd5b698d828cdb7392fae1db0386354a8d327 |
|
MD5 | 77d318b37086843cc198b89f6fe319e1 |
|
BLAKE2b-256 | ee91ffc3eda8979129dceb25da6e281999527ec213aeeca0c60e4d7d861dbb02 |
File details
Details for the file llama_index_indices_managed_vectara-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: llama_index_indices_managed_vectara-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc7a4b4d18f2d73db62ffba6cd312f2b09a15e3379c8b32674ec522a0b07260b |
|
MD5 | 1199aac3d2fd45a327268b249bc04138 |
|
BLAKE2b-256 | 2e9aaa3c4d5f24268011897e254bdec5f66892a8dd27f787d6dbf39c4590aa25 |