[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/snexus/llm-search/blob/main/notebooks/llmsearch_google_colab_demo.ipynb)
# pyLLMSeach - Advanced RAG, ready to use
The purpose of this package is to offer a convenient question-answering (RAG) system with a simple YAML-based configuration that enables interaction with multiple collections of local documents. Special attention is given to improvements in various components of the system **in addition to basic LLN based RAGs** - better document parsing, hybrid search, HyDE enabled search, chat history, deep linking, re-ranking, the ability to customize embeddings, and more. The package is designed to work with custom Large Language Models (LLMs) – whether from OpenAI or installed locally.
## Features
* Supported formats
* Build-in parsers:
* `.md` - Divides files based on logical components such as headings, subheadings, and code blocks. Supports additional features like cleaning image links, adding custom metadata, and more.
* `.pdf` - MuPDF-based parser.
* `.docx` - custom parser, supports nested tables.
* Other common formats are supported by `Unstructured` pre-processor:
* List of formats https://unstructured-io.github.io/unstructured/core/partition.html
* Supports multiple collection of documents, and filtering the results by a collection.
* An ability to update the embeddings incrementally, without a need to re-index the entire document base.
* Generates dense embeddings from a folder of documents and stores them in a vector database (ChromaDB).
* The following embedding models are supported:
* Huggingface embeddings.
* Sentence-transformers-based models, e.g., `multilingual-e5-base`.
* Instructor-based models, e.g., `instructor-large`.
* Generates sparse embeddings using SPLADE (https://github.com/naver/splade) to enable hybrid search (sparse + dense).
* Supports the "Retrieve and Re-rank" strategy for semantic search, see - https://www.sbert.net/examples/applications/retrieve_rerank/README.html.
* Besides the originally `ms-marco-MiniLM` cross-encoder, more modern `bge-reranker` is supported.
* Supports HyDE (Hypothetical Document Embeddings) - https://arxiv.org/pdf/2212.10496.pdf
* WARNING: Enabling HyDE (via config OR webapp) can significantly alter the quality of the results. Please make sure to read the paper before enabling.
* From my own experiments, enabling HyDE significantly boosts quality of the output on a topics where user can't formulate the quesiton using domain specific language of the topic - e.g. when learning new topics.
* Support for multi-querying, inspired by `RAG Fusion` - https://towardsdatascience.com/forget-rag-the-future-is-rag-fusion-1147298d8ad1
* When multi-querying is turned on (either config or webapp), the original query will be replaced by 3 variants of the same query, allowing to bridge the gap in the terminology and "offer different angles or perspectives" according to the article.
* Supprts optional chat history with question contextualization
* Allows interaction with embedded documents, internally supporting the following models and methods (including locally hosted):
* OpenAI models (ChatGPT 3.5/4 and Azure OpenAI).
* HuggingFace models.
* Llama cpp supported models - for full list see https://github.com/ggerganov/llama.cpp#description
* AutoGPTQ models (temporarily disabled due to broken dependencies).
* Interoperability with LiteLLM + Ollama via OpenAI API, supporting hundreds of different models (see [Model configuration for LiteLLM](sample_templates/llm/litellm.yaml))
* Other features
* Simple CLI and web interfaces.
* Deep linking into document sections - jump to an individual PDF page or a header in a markdown file.
* Ability to save responses to an offline database for future analysis.
* Experimental API
## Demo
![Demo](media/llmsearch-demo-v2.gif)
## Documentation
[Browse Documentation](https://llm-search.readthedocs.io/en/latest/)
Raw data
{
"_id": null,
"home_page": null,
"name": "pyllmsearch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "llm, rag, retrieval-augemented-generation, large-language-models, local, splade, hyde, reranking, chroma, openai",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/db/78/fb7201479240dc116557bb3cfd013b459affffcbd78897decd4c85b3968c/pyllmsearch-0.7.0.tar.gz",
"platform": null,
"description": "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/snexus/llm-search/blob/main/notebooks/llmsearch_google_colab_demo.ipynb)\n\n# pyLLMSeach - Advanced RAG, ready to use\n\nThe purpose of this package is to offer a convenient question-answering (RAG) system with a simple YAML-based configuration that enables interaction with multiple collections of local documents. Special attention is given to improvements in various components of the system **in addition to basic LLN based RAGs** - better document parsing, hybrid search, HyDE enabled search, chat history, deep linking, re-ranking, the ability to customize embeddings, and more. The package is designed to work with custom Large Language Models (LLMs) \u2013 whether from OpenAI or installed locally.\n\n## Features\n\n* Supported formats\n * Build-in parsers:\n * `.md` - Divides files based on logical components such as headings, subheadings, and code blocks. Supports additional features like cleaning image links, adding custom metadata, and more.\n * `.pdf` - MuPDF-based parser.\n * `.docx` - custom parser, supports nested tables.\n * Other common formats are supported by `Unstructured` pre-processor:\n * List of formats https://unstructured-io.github.io/unstructured/core/partition.html\n\n* Supports multiple collection of documents, and filtering the results by a collection.\n\n* An ability to update the embeddings incrementally, without a need to re-index the entire document base.\n\n* Generates dense embeddings from a folder of documents and stores them in a vector database (ChromaDB).\n * The following embedding models are supported:\n * Huggingface embeddings.\n * Sentence-transformers-based models, e.g., `multilingual-e5-base`.\n * Instructor-based models, e.g., `instructor-large`.\n\n* Generates sparse embeddings using SPLADE (https://github.com/naver/splade) to enable hybrid search (sparse + dense).\n\n* Supports the \"Retrieve and Re-rank\" strategy for semantic search, see - https://www.sbert.net/examples/applications/retrieve_rerank/README.html.\n * Besides the originally `ms-marco-MiniLM` cross-encoder, more modern `bge-reranker` is supported.\n\n* Supports HyDE (Hypothetical Document Embeddings) - https://arxiv.org/pdf/2212.10496.pdf\n * WARNING: Enabling HyDE (via config OR webapp) can significantly alter the quality of the results. Please make sure to read the paper before enabling.\n * From my own experiments, enabling HyDE significantly boosts quality of the output on a topics where user can't formulate the quesiton using domain specific language of the topic - e.g. when learning new topics.\n\n* Support for multi-querying, inspired by `RAG Fusion` - https://towardsdatascience.com/forget-rag-the-future-is-rag-fusion-1147298d8ad1\n * When multi-querying is turned on (either config or webapp), the original query will be replaced by 3 variants of the same query, allowing to bridge the gap in the terminology and \"offer different angles or perspectives\" according to the article.\n\n* Supprts optional chat history with question contextualization\n\n* Allows interaction with embedded documents, internally supporting the following models and methods (including locally hosted):\n * OpenAI models (ChatGPT 3.5/4 and Azure OpenAI).\n * HuggingFace models.\n * Llama cpp supported models - for full list see https://github.com/ggerganov/llama.cpp#description\n * AutoGPTQ models (temporarily disabled due to broken dependencies).\n\n* Interoperability with LiteLLM + Ollama via OpenAI API, supporting hundreds of different models (see [Model configuration for LiteLLM](sample_templates/llm/litellm.yaml))\n\n* Other features\n * Simple CLI and web interfaces.\n * Deep linking into document sections - jump to an individual PDF page or a header in a markdown file.\n * Ability to save responses to an offline database for future analysis.\n * Experimental API\n\n\n## Demo\n\n![Demo](media/llmsearch-demo-v2.gif)\n\n\n## Documentation\n\n[Browse Documentation](https://llm-search.readthedocs.io/en/latest/)\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "LLM Powered Advanced RAG Application",
"version": "0.7.0",
"project_urls": {
"Documentation": "https://llm-search.readthedocs.io/en/latest/",
"Homepage": "https://github.com/snexus/llm-search"
},
"split_keywords": [
"llm",
" rag",
" retrieval-augemented-generation",
" large-language-models",
" local",
" splade",
" hyde",
" reranking",
" chroma",
" openai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bdf835c58c7c34aa7eac83a3c28867962933be9cb2640d915d6e6dc29153db87",
"md5": "7776b89c38756f5103956af3c7b64290",
"sha256": "672155af23ece103dcb1c6629cbf18122d8315f992bd99df41823b6d882a7dc3"
},
"downloads": -1,
"filename": "pyllmsearch-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7776b89c38756f5103956af3c7b64290",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 57044,
"upload_time": "2024-03-29T09:40:48",
"upload_time_iso_8601": "2024-03-29T09:40:48.894376Z",
"url": "https://files.pythonhosted.org/packages/bd/f8/35c58c7c34aa7eac83a3c28867962933be9cb2640d915d6e6dc29153db87/pyllmsearch-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db78fb7201479240dc116557bb3cfd013b459affffcbd78897decd4c85b3968c",
"md5": "931a2be479711ea6ac77bdbaa56638ac",
"sha256": "d0565cbbb3f11b50bb9f0f9b639cf93f4798035196a97010897a06700e3fff50"
},
"downloads": -1,
"filename": "pyllmsearch-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "931a2be479711ea6ac77bdbaa56638ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 2151714,
"upload_time": "2024-03-29T09:40:51",
"upload_time_iso_8601": "2024-03-29T09:40:51.823871Z",
"url": "https://files.pythonhosted.org/packages/db/78/fb7201479240dc116557bb3cfd013b459affffcbd78897decd4c85b3968c/pyllmsearch-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-29 09:40:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "snexus",
"github_project": "llm-search",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyllmsearch"
}