llama-index-packs-vectara-rag


Namellama-index-packs-vectara-rag JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs vectara_rag integration
upload_time2024-11-18 00:54:36
maintainerofermend
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseMIT
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.

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_CUSTOMER_ID=your_customer_id
VECTARA_CORPUS_ID=your_corpus_id
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', 'udf', 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-v1.2.0'.
    Scale customers can use 'vectara-summary-ext-v1.3.0

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": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/c6/70/73d085cc175ba25bda526ebdbcc149ccb5c4640bf2f7a14c381ee3803ef1/llama_index_packs_vectara_rag-0.3.0.tar.gz",
    "platform": null,
    "description": "# Vectara RAG Pack\n\nThis LlamaPack provides an end-to-end Retrieval Augmented Generation flow using Vectara.\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_CUSTOMER_ID=your_customer_id\nVECTARA_CORPUS_ID=your_corpus_id\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', 'udf', 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-v1.2.0'.\n    Scale customers can use 'vectara-summary-ext-v1.3.0\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": "MIT",
    "summary": "llama-index packs vectara_rag integration",
    "version": "0.3.0",
    "project_urls": null,
    "split_keywords": [
        "embeddings",
        " rag",
        " retrieval",
        " vectara"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67a020f30dbc76a55e8f63b893f05da1a2bd21145fa20b6464a2162e33a86041",
                "md5": "308c607f480de0ef119b8885b89d7963",
                "sha256": "5f5fc21bb6126dcc9eac0f8707892212dfdae2fc2613bcb3d9d71b432ea423ad"
            },
            "downloads": -1,
            "filename": "llama_index_packs_vectara_rag-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "308c607f480de0ef119b8885b89d7963",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 3743,
            "upload_time": "2024-11-18T00:54:36",
            "upload_time_iso_8601": "2024-11-18T00:54:36.006247Z",
            "url": "https://files.pythonhosted.org/packages/67/a0/20f30dbc76a55e8f63b893f05da1a2bd21145fa20b6464a2162e33a86041/llama_index_packs_vectara_rag-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c67073d085cc175ba25bda526ebdbcc149ccb5c4640bf2f7a14c381ee3803ef1",
                "md5": "4e888b84a175611666a1f8cae65c42cb",
                "sha256": "0306150b3bfa0d4b0240e959f54a50c94f772ce433a13dcbf6ed57115cf3dfb7"
            },
            "downloads": -1,
            "filename": "llama_index_packs_vectara_rag-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4e888b84a175611666a1f8cae65c42cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3588,
            "upload_time": "2024-11-18T00:54:36",
            "upload_time_iso_8601": "2024-11-18T00:54:36.826903Z",
            "url": "https://files.pythonhosted.org/packages/c6/70/73d085cc175ba25bda526ebdbcc149ccb5c4640bf2f7a14c381ee3803ef1/llama_index_packs_vectara_rag-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 00:54:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-vectara-rag"
}
        
Elapsed time: 0.34289s