|
1 |
| -# qdurllm |
| 1 | +<h1 align="center">qdurllm</h1> |
| 2 | +<h2 align="center">Search your favorite websites and chat with them, on your desktop🌐</h2> |
2 | 3 |
|
3 |
| -**qdurllm** is a local search engine that lets you search through different URLs, retrieve and chat with their content, powered by Qdrant, Langchain, llama.cpp and Gradio. |
4 | 4 |
|
5 |
| -## Quickstart |
| 5 | +<div align="center"> |
| 6 | + <img src="https://img.shields.io/github/languages/top/AstraBert/qdurllm" alt="GitHub top language"> |
| 7 | + <img src="https://img.shields.io/github/commit-activity/t/AstraBert/qdurllm" alt="GitHub commit activity"> |
| 8 | + <img src="https://img.shields.io/badge/qdurllm-stable_beta-green" alt="Static Badge"> |
| 9 | + <img src="https://img.shields.io/badge/Release-v0.0.0b-purple" alt="Static Badge"> |
| 10 | + <img src="https://img.shields.io/docker/image-size/astrabert/local-search-application |
| 11 | + " alt="Docker image size"> |
| 12 | + <img src="https://img.shields.io/badge/Supported_platforms-Windows/macOS/Linux-brown" alt="Static Badge"> |
| 13 | + <div> |
| 14 | + <img src="./imgs/qdurllm.png" alt="Flowchart" align="center"> |
| 15 | + <p><i>Flowchart for everything-ai</i></p> |
| 16 | + </div> |
| 17 | +</div> |
6 | 18 |
|
7 |
| -### Installation |
| 19 | +**qdurllm** (**Qd**rant **URL**s and **L**arge **L**anguage **M**odels) is a local search engine that lets you select and upload URL content to a vector database: after that, you can search, retrieve and chat with this content. |
| 20 | + |
| 21 | +This is provisioned through a multi-container Docker application, leveraging Qdrant, Langchain, llama.cpp, quantized Gemma and Gradio. |
| 22 | + |
| 23 | +## Requirements |
| 24 | + |
| 25 | +The only requirement is to have `docker` and `docker-compose`. |
| 26 | + |
| 27 | +If you don't have them, make sure to install them [here](https://docs.docker.com/get-docker/). |
| 28 | + |
| 29 | +## Installation |
| 30 | + |
| 31 | +You can install the application by cloning the GitHub repository |
8 | 32 |
|
9 | 33 | ```bash
|
10 | 34 | git clone https://github.com/AstraBert/qdurllm.git
|
11 | 35 | cd qdurllm
|
12 | 36 | ```
|
13 | 37 |
|
14 |
| -### Run it! |
| 38 | +Or you can simply paste the following text into a `compose.yaml` file: |
| 39 | + |
| 40 | +```yaml |
| 41 | +networks: |
| 42 | + mynet: |
| 43 | + driver: bridge |
| 44 | +services: |
| 45 | + local-search-application: |
| 46 | + image: astrabert/local-search-application |
| 47 | + networks: |
| 48 | + - mynet |
| 49 | + ports: |
| 50 | + - "7860:7860" |
| 51 | + qdrant: |
| 52 | + image: qdrant/qdrant |
| 53 | + ports: |
| 54 | + - "6333:6333" |
| 55 | + volumes: |
| 56 | + - "./qdrant_storage:/qdrant/storage" |
| 57 | + networks: |
| 58 | + - mynet |
| 59 | + llama_server: |
| 60 | + image: astrabert/llama.cpp-gemma |
| 61 | + ports: |
| 62 | + - "8000:8000" |
| 63 | + networks: |
| 64 | + - mynet |
| 65 | +``` |
| 66 | +
|
| 67 | +Placing the file in whatever directory you want in your file system. |
| 68 | +
|
| 69 | +Prior to running the application, you can optionally pull all the needed images from Docker hub: |
| 70 | +
|
| 71 | +```bash |
| 72 | +docker pull qdrant/qdrant |
| 73 | +docker pull astrabert/llama.cpp-gemma |
| 74 | +docker pull astrabert/local-search-application |
| 75 | +``` |
| 76 | + |
| 77 | +## How does it work? |
| 78 | + |
| 79 | +When launched (see [Usage](#usage)), the application runs three containers: |
| 80 | + |
| 81 | +- `qdrant`(port 6333): serves as vector database provider for semantic search-based retrieval |
| 82 | +- `llama.cpp-gemma`(port 8000): this is an implementation of a [quantized Gemma model](https://huggingface.co/lmstudio-ai/gemma-2b-it-GGUF) provided by LMStudio and Google, served with `llama.cpp` server. This works for text-generation scopes, enriching the search experience of the user. |
| 83 | +- `local-search-application`(port 7860): a Gradio tabbed interface with: |
| 84 | + + The possibility to upload one or multiple contents by specifying the URL (thanks to Langchain) |
| 85 | + + The possibility to chat with the uploaded URLs thanks to `llama.cpp-gemma` |
| 86 | + + The possibility to perform a direct search that leverages double-layered retrieval with `all-MiniLM-L6-v2` (that identifies the 10 best matches) and `sentence-t5-base` (that re-encodes the 10 best matches and extracts the best hit from them) - this is the same RAG implementation used in combination with `llama.cpp-gemma`. |
| 87 | + |
| 88 | +> _The overall computational burden is light enough to make the application run not only GPUless, but also with low RAM availability (>=8GB, although it can take up to 10 mins for Gemma to respond on 8GB RAM)._ |
| 89 | +
|
| 90 | +## Usage |
| 91 | + |
| 92 | +### Run it |
| 93 | + |
| 94 | +You can make the application work with the following - really simple - command, which has to be run within the same directory where you stored your `compose.yaml` file: |
15 | 95 |
|
16 | 96 | ```bash
|
17 | 97 | docker compose up -d
|
18 | 98 | ```
|
19 | 99 |
|
20 |
| -You'll find the application running at `http://localhost:7860` or `http://0.0.0.0:7860` |
| 100 | +If you've already pulled all the images, you'll find the application running at `http://localhost:7860` or `http://0.0.0.0:7860` in less than a minute. |
| 101 | + |
| 102 | +If you have not pulled the images, you'll have to wait that their installation is complete before actually using the application. |
| 103 | + |
| 104 | +### Use it |
| 105 | + |
| 106 | +Once the app is loaded, you'll find a first tab in which you can write the URLs whose content you want to interact with: |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +Now that your URLs are uploaded, you can either chat with their content through `llama.cpp-gemma`: |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +> _Note that you can also set parameters like maximum output tokens, temperature, repetition penalty and generation seed_ |
| 115 | +
|
| 116 | +Or you can use double-layered-retrieval semantic search to query your URL content(s) directly: |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +## License and rights of usage |
| 121 | + |
| 122 | +The software is (and will always be) open-source, provided under [MIT license](./LICENSE). |
| 123 | + |
| 124 | +Anyone can use, modify and redistribute any portion of it, as long as the author, [Astra Clelia Bertelli](https://astrabert.vercel.app) is cited. |
| 125 | + |
| 126 | +## Contributions and funding |
21 | 127 |
|
22 |
| -## Flowchart |
| 128 | +Contribution are always more than welcome! Feel free to flag issues, open PRs or [contact the author](mailto:[email protected]) to suggest any changes, request features or improve the code. |
23 | 129 |
|
24 |
| - |
| 130 | +If you found the application useful, please consider [funding it](https://github.com/sponsors/AstraBert) in order to allow improvements! |
0 commit comments