llama-index-packs-vectara-rag


Namellama-index-packs-vectara-rag JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs vectara_rag integration
upload_time2025-07-31 02:23:41
maintainerofermend
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseNone
keywords embeddings rag retrieval vectara
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Vectara RAG Pack

This LlamaPack provides an end-to-end Retrieval Augmented Generation flow using Vectara.
Please note that this guide is only relevant for versions >= 0.4.0

To use the Vectara RAG Pack, you will need a Vectara account. If you don't have one already, you can [sign up](https://vectara.com/integrations/llamaindex)
and follow our [Quick Start](https://docs.vectara.com/docs/quickstart) guide to create a corpus and an API key (make sure it has both indexing and query permissions).

You can then configure your environment or provide the following arguments directly when initializing your VectaraIndex:

```
VECTARA_CORPUS_KEY=your_corpus_key
VECTARA_API_KEY=your-vectara-api-key
```

## CLI Usage

You can download the Vectara llamapack directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:

```bash
llamaindex-cli download-llamapack VectaraRagPack --download-dir ./vectara_rag_pack
```

Feel free to inspect the files at `./vectara_rag_pack` and use them as a template for your own project!

## Code Usage

You can download the pack to a `./vectara_rag_pack` directory:

```python
from llama_index.core.llama_pack import download_llama_pack

VectaraRAG = download_llama_pack("VectaraRagPack", "./vectara_rag_pack")
```

Then, you can set up the pack in two ways:

1. If you want to ingest documents into the Vectara Corpus:

```python
nodes = [...]
vectara = VectaraRAG(nodes=nodes)
```

2. If you already indexed data on Vectara, and just want to use the retrieval/query functionality:

```python
vectara = VectaraRAG()
```

Additional optional arguments to VectaraRAG:

- `similarity_top_k`: determines the number of results to return. Defaults to 5.
- `lambda_val`: a value between 0 and 1 to specify hybrid search,
  determines the balance between pure neural search (0) and keyword matching (1).
- `n_sentences_before` and `n_sentences_after`: determine the number of sentences before/after the
  matching fact to use with the summarization LLM. defaults to 2.
- `reranker`: 'none', 'mmr', 'multilingual_reranker_v1', 'userfn', or 'chain'
  The reranker name 'slingshot' is the same as 'multilingual_reranker_v1' (backwards compatible)
- `rerank_k`: the number of results to use for reranking, defaults to 50.
- `mmr_diversity_bias`: when using the mmr reranker, determines the degree
  of diversity among the results with 0 corresponding
  to minimum diversity and 1 to maximum diversity. Defaults to 0.3.
- `udf_expression`: when using the udf reranker, specifies the user expression for reranking results.
- `rerank_chain`: when using the chain reranker, specifies a list of rerankers to be applied
  in a sequence and their associated parameters.
- `summary_enabled`: whether to generate summaries or not. Defaults to True.
- When summary_enabled is True, you can set the following:
  - `summary_response_lang`: language to use (ISO 639-2 code) for summary generation. defaults to "eng".
  - `summary_num_results`: number of results to use for summary generation. Defaults to 7.
  - `summary_prompt_name`: name of the prompt to use for summary generation.
    Defaults to 'vectara-summary-ext-24-05-sml'.

For example to use maximal diversity with MMR:

```python
vectara = VectaraRAG(reranker="mmr", rerank_k=50, mmr_diversity_bias=1.0)
```

Or if you want to include more results in the Vectara generated summarization you can try:

```python
vectara = VectaraRAG(summary_num_results=12)
```

Once you have the Vectara RAG object, you can now use it as a retriever:

```python
# use the retriever
nodes = vectara.retrieve("Is light a wave or a particle?")
```

Or as a query engine (with Vectara summarization call):

```python
# use the query engine
response = vectara._query_engine.query(
    "Is light a wave or a particle?"
).response
```

Note that the `run()` function is a light wrapper around `query_engine.query()`.

```python
response = vectara.run("Is light a wave or a particle?").response
```

Enjoy your Vectara RAG pack!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-packs-vectara-rag",
    "maintainer": "ofermend",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "embeddings, rag, retrieval, vectara",
    "author": null,
    "author_email": "Your Name <you@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/7a/bc/f0df151021c5f781ef6e48231f9c2785a41df78ce47f9c812a36b9e427dc/llama_index_packs_vectara_rag-0.5.0.tar.gz",
    "platform": null,
    "description": "# Vectara RAG Pack\n\nThis LlamaPack provides an end-to-end Retrieval Augmented Generation flow using Vectara.\nPlease note that this guide is only relevant for versions >= 0.4.0\n\nTo use the Vectara RAG Pack, you will need a Vectara account. If you don't have one already, you can [sign up](https://vectara.com/integrations/llamaindex)\nand follow our [Quick Start](https://docs.vectara.com/docs/quickstart) guide to create a corpus and an API key (make sure it has both indexing and query permissions).\n\nYou can then configure your environment or provide the following arguments directly when initializing your VectaraIndex:\n\n```\nVECTARA_CORPUS_KEY=your_corpus_key\nVECTARA_API_KEY=your-vectara-api-key\n```\n\n## CLI Usage\n\nYou can download the Vectara llamapack directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:\n\n```bash\nllamaindex-cli download-llamapack VectaraRagPack --download-dir ./vectara_rag_pack\n```\n\nFeel free to inspect the files at `./vectara_rag_pack` and use them as a template for your own project!\n\n## Code Usage\n\nYou can download the pack to a `./vectara_rag_pack` directory:\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\nVectaraRAG = download_llama_pack(\"VectaraRagPack\", \"./vectara_rag_pack\")\n```\n\nThen, you can set up the pack in two ways:\n\n1. If you want to ingest documents into the Vectara Corpus:\n\n```python\nnodes = [...]\nvectara = VectaraRAG(nodes=nodes)\n```\n\n2. If you already indexed data on Vectara, and just want to use the retrieval/query functionality:\n\n```python\nvectara = VectaraRAG()\n```\n\nAdditional optional arguments to VectaraRAG:\n\n- `similarity_top_k`: determines the number of results to return. Defaults to 5.\n- `lambda_val`: a value between 0 and 1 to specify hybrid search,\n  determines the balance between pure neural search (0) and keyword matching (1).\n- `n_sentences_before` and `n_sentences_after`: determine the number of sentences before/after the\n  matching fact to use with the summarization LLM. defaults to 2.\n- `reranker`: 'none', 'mmr', 'multilingual_reranker_v1', 'userfn', or 'chain'\n  The reranker name 'slingshot' is the same as 'multilingual_reranker_v1' (backwards compatible)\n- `rerank_k`: the number of results to use for reranking, defaults to 50.\n- `mmr_diversity_bias`: when using the mmr reranker, determines the degree\n  of diversity among the results with 0 corresponding\n  to minimum diversity and 1 to maximum diversity. Defaults to 0.3.\n- `udf_expression`: when using the udf reranker, specifies the user expression for reranking results.\n- `rerank_chain`: when using the chain reranker, specifies a list of rerankers to be applied\n  in a sequence and their associated parameters.\n- `summary_enabled`: whether to generate summaries or not. Defaults to True.\n- When summary_enabled is True, you can set the following:\n  - `summary_response_lang`: language to use (ISO 639-2 code) for summary generation. defaults to \"eng\".\n  - `summary_num_results`: number of results to use for summary generation. Defaults to 7.\n  - `summary_prompt_name`: name of the prompt to use for summary generation.\n    Defaults to 'vectara-summary-ext-24-05-sml'.\n\nFor example to use maximal diversity with MMR:\n\n```python\nvectara = VectaraRAG(reranker=\"mmr\", rerank_k=50, mmr_diversity_bias=1.0)\n```\n\nOr if you want to include more results in the Vectara generated summarization you can try:\n\n```python\nvectara = VectaraRAG(summary_num_results=12)\n```\n\nOnce you have the Vectara RAG object, you can now use it as a retriever:\n\n```python\n# use the retriever\nnodes = vectara.retrieve(\"Is light a wave or a particle?\")\n```\n\nOr as a query engine (with Vectara summarization call):\n\n```python\n# use the query engine\nresponse = vectara._query_engine.query(\n    \"Is light a wave or a particle?\"\n).response\n```\n\nNote that the `run()` function is a light wrapper around `query_engine.query()`.\n\n```python\nresponse = vectara.run(\"Is light a wave or a particle?\").response\n```\n\nEnjoy your Vectara RAG pack!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "llama-index packs vectara_rag integration",
    "version": "0.5.0",
    "project_urls": null,
    "split_keywords": [
        "embeddings",
        " rag",
        " retrieval",
        " vectara"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "121521f7522434246146eed9a9b0b20976ff3bac52f7267a380d896b732136dd",
                "md5": "5bcdf35f2e3653f8310f4398ee39b766",
                "sha256": "fe45770c6054297fec6c538f46fdaa20e7887e0ceb26dc326c57923a540d929f"
            },
            "downloads": -1,
            "filename": "llama_index_packs_vectara_rag-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bcdf35f2e3653f8310f4398ee39b766",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4570,
            "upload_time": "2025-07-31T02:23:40",
            "upload_time_iso_8601": "2025-07-31T02:23:40.327425Z",
            "url": "https://files.pythonhosted.org/packages/12/15/21f7522434246146eed9a9b0b20976ff3bac52f7267a380d896b732136dd/llama_index_packs_vectara_rag-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7abcf0df151021c5f781ef6e48231f9c2785a41df78ce47f9c812a36b9e427dc",
                "md5": "6170352e9afbb98a21115138b2b246e2",
                "sha256": "7770dbe86a83c1ecc5ffb72213a12996d9a44f0252a22715272ba65bd27698aa"
            },
            "downloads": -1,
            "filename": "llama_index_packs_vectara_rag-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6170352e9afbb98a21115138b2b246e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5013,
            "upload_time": "2025-07-31T02:23:41",
            "upload_time_iso_8601": "2025-07-31T02:23:41.472619Z",
            "url": "https://files.pythonhosted.org/packages/7a/bc/f0df151021c5f781ef6e48231f9c2785a41df78ce47f9c812a36b9e427dc/llama_index_packs_vectara_rag-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-31 02:23:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-vectara-rag"
}
        
Elapsed time: 1.25777s