Skip to content

Commit c936e0b

Browse files
committed
docs
1 parent 1eed41a commit c936e0b

File tree

8 files changed

+141
-22
lines changed

8 files changed

+141
-22
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Astra Clelia Bertelli
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 114 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,130 @@
1-
# qdurllm
1+
<h1 align="center">qdurllm</h1>
2+
<h2 align="center">Search your favorite websites and chat with them, on your desktop🌐</h2>
23

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.
44

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>
618

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
832

933
```bash
1034
git clone https://github.com/AstraBert/qdurllm.git
1135
cd qdurllm
1236
```
1337

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:
1595

1696
```bash
1797
docker compose up -d
1898
```
1999

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+
![upload_URLs](./imgs/tutorial1.png)
109+
110+
Now that your URLs are uploaded, you can either chat with their content through `llama.cpp-gemma`:
111+
112+
![chat_with_URLs](./imgs/tutorial2.png)
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+
![direct_search](./imgs/tutorial3.png)
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
21127

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.
23129

24-
![Flowchart](imgs/qdurllm.png)
130+
If you found the application useful, please consider [funding it](https://github.com/sponsors/AstraBert) in order to allow improvements!

application/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
FROM astrabert/local-search-application:latest
1+
FROM python:3.10.14-slim-bookworm
22

33
WORKDIR /app
44

5-
RUN mkdir -p /app/scripts
5+
ADD . /app/
66

7-
ADD ./scripts/*.py /app/scripts/
7+
RUN python3 -m pip cache purge
8+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
9+
RUN python3 -m nltk.downloader all
810

911
EXPOSE 7860
1012

application/build_command.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

application/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ qdrant_client==1.9.0
33
nltk==3.8.1
44
spacy==3.7.2
55
sentence_transformers==3.0.0
6+
psutil
67
unstructured
78
langchain
89
langchain_core

imgs/tutorial1.png

59.7 KB
Loading

imgs/tutorial2.png

126 KB
Loading

imgs/tutorial3.png

95.6 KB
Loading

0 commit comments

Comments
 (0)