llama-index-packs-sentence-window-retriever


Namellama-index-packs-sentence-window-retriever JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
Summaryllama-index packs sentence_window_retriever integration
upload_time2024-11-18 01:33:59
maintainerjerryjliu
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseMIT
keywords retriever sentence window
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sentence Window Retriever

This LlamaPack provides an example of our sentence window retriever.

This specific template shows the e2e process of building this. It loads
a document, chunks it up, adds surrounding context as metadata to each chunk,
and during retrieval inserts the context back into each chunk for response synthesis.

Check out the [notebook here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/sentence_window_retriever/sentence_window.ipynb).

## CLI Usage

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

```bash
llamaindex-cli download-llamapack SentenceWindowRetrieverPack --download-dir ./sentence_window_retriever_pack
```

You can then inspect the files at `./sentence_window_retriever_pack` and use them as a template for your own project.

## Code Usage

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

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

# download and install dependencies
SentenceWindowRetrieverPack = download_llama_pack(
    "SentenceWindowRetrieverPack", "./sentence_window_retriever_pack"
)
```

From here, you can use the pack, or inspect and modify the pack in `./sentence_window_retriever_pack`.

Then, you can set up the pack like so:

```python
# create the pack
# get documents from any data loader
sentence_window_retriever_pack = SentenceWindowRetrieverPack(
    documents,
)
```

The `run()` function is a light wrapper around `query_engine.query()`.

```python
response = sentence_window_retriever_pack.run(
    "Tell me a bout a Music celebritiy."
)
```

You can also use modules individually.

```python
# get the sentence vector index
index = sentence_window_retriever_pack.sentence_index

# get the node parser
node_parser = sentence_window_retriever_pack.node_parser

# get the metadata replacement postprocessor
postprocessor = sentence_window_retriever_pack.postprocessor

# get the query engine
query_engine = sentence_window_retriever_pack.query_engine
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-packs-sentence-window-retriever",
    "maintainer": "jerryjliu",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "retriever, sentence, window",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/25/4c/5ebe0ab1a25b8787c3e940c56e4765abaf2c447f2d711f0a0ecc63e65631/llama_index_packs_sentence_window_retriever-0.4.0.tar.gz",
    "platform": null,
    "description": "# Sentence Window Retriever\n\nThis LlamaPack provides an example of our sentence window retriever.\n\nThis specific template shows the e2e process of building this. It loads\na document, chunks it up, adds surrounding context as metadata to each chunk,\nand during retrieval inserts the context back into each chunk for response synthesis.\n\nCheck out the [notebook here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/sentence_window_retriever/sentence_window.ipynb).\n\n## CLI Usage\n\nYou can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:\n\n```bash\nllamaindex-cli download-llamapack SentenceWindowRetrieverPack --download-dir ./sentence_window_retriever_pack\n```\n\nYou can then inspect the files at `./sentence_window_retriever_pack` and use them as a template for your own project.\n\n## Code Usage\n\nYou can download the pack to a the `./sentence_window_retriever_pack` directory:\n\n```python\nfrom llama_index.core.llama_pack import download_llama_pack\n\n# download and install dependencies\nSentenceWindowRetrieverPack = download_llama_pack(\n    \"SentenceWindowRetrieverPack\", \"./sentence_window_retriever_pack\"\n)\n```\n\nFrom here, you can use the pack, or inspect and modify the pack in `./sentence_window_retriever_pack`.\n\nThen, you can set up the pack like so:\n\n```python\n# create the pack\n# get documents from any data loader\nsentence_window_retriever_pack = SentenceWindowRetrieverPack(\n    documents,\n)\n```\n\nThe `run()` function is a light wrapper around `query_engine.query()`.\n\n```python\nresponse = sentence_window_retriever_pack.run(\n    \"Tell me a bout a Music celebritiy.\"\n)\n```\n\nYou can also use modules individually.\n\n```python\n# get the sentence vector index\nindex = sentence_window_retriever_pack.sentence_index\n\n# get the node parser\nnode_parser = sentence_window_retriever_pack.node_parser\n\n# get the metadata replacement postprocessor\npostprocessor = sentence_window_retriever_pack.postprocessor\n\n# get the query engine\nquery_engine = sentence_window_retriever_pack.query_engine\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index packs sentence_window_retriever integration",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [
        "retriever",
        " sentence",
        " window"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a0b0594a9d7d610df2fe1cd27079462e1b63de2f4dd2943f96f801aad9e652a",
                "md5": "fb6b7e01b85506bb5e4193200f47f1bd",
                "sha256": "e5b309dddcece9a5199197a81bc8d52da521fdeb1f344a0eeed4f6a9671068e6"
            },
            "downloads": -1,
            "filename": "llama_index_packs_sentence_window_retriever-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb6b7e01b85506bb5e4193200f47f1bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 3518,
            "upload_time": "2024-11-18T01:33:58",
            "upload_time_iso_8601": "2024-11-18T01:33:58.344036Z",
            "url": "https://files.pythonhosted.org/packages/9a/0b/0594a9d7d610df2fe1cd27079462e1b63de2f4dd2943f96f801aad9e652a/llama_index_packs_sentence_window_retriever-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "254c5ebe0ab1a25b8787c3e940c56e4765abaf2c447f2d711f0a0ecc63e65631",
                "md5": "e6080d9a076b89ff7adf4805d9142133",
                "sha256": "fef179200087c9bf33d1802c9f05a1abe7120c88c382358c45bd8fbd5ecba97b"
            },
            "downloads": -1,
            "filename": "llama_index_packs_sentence_window_retriever-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e6080d9a076b89ff7adf4805d9142133",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3134,
            "upload_time": "2024-11-18T01:33:59",
            "upload_time_iso_8601": "2024-11-18T01:33:59.214355Z",
            "url": "https://files.pythonhosted.org/packages/25/4c/5ebe0ab1a25b8787c3e940c56e4765abaf2c447f2d711f0a0ecc63e65631/llama_index_packs_sentence_window_retriever-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 01:33:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-packs-sentence-window-retriever"
}
        
Elapsed time: 2.78067s