[Docker Edition] Try LLM Vector Search with a Web Application


# nlp4j-web-vectorsearch

This is a web application for storing documents in a vector database and performing document searches within the vector database.

It also includes a keyword search function, allowing you to compare the results of vector searches against traditional keyword-based searches.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/110265/24d0db3b-f4ba-7618-e35a-1adb607c7487.png)

# 0. Prerequisites

You need an environment where Docker is operational.

# 1. Installation

## 1-1. Installing and Running the Embedding Server

Install the Multilingual-E5-large Embedding Server (nlp4j-llm-embeddings-e5).

### Installation

```bash
docker pull oyahiroki/nlp4j-llm-embeddings-e5:1.0.0.0
```

### Execution (The first run may take about 5 minutes due to downloading model files.)

```bash
docker run -d --name nlp4j-llm-embeddings-e5 -p 8888:8888 oyahiroki/nlp4j-llm-embeddings-e5:1.0.0.0
```

### Example Output

```bash
>docker pull oyahiroki/nlp4j-web-vectorsearch:1.0.0.0
1.0.0.0: Pulling from oyahiroki/nlp4j-web-vectorsearch
cb57fedf0fd8: Download complete
80338217a4ab: Download complete
d1eecb43db8a: Download complete
b317c36e5a10: Download complete
1a5fd5c7e184: Download complete
b24483e35971: Download complete
5b1aa583d1ef: Download complete
10970da6d1d3: Download complete
90a925ab929a: Download complete
57bd701990a7: Download complete
7d9a34308537: Download complete
7478e0ac0f23: Download complete
4c7deb2ac32b: Download complete
727d8fc35079: Download complete
4f4fb700ef54: Already exists
edf7dd409191: Download complete
350cf53fd52a: Download complete
Digest: sha256:9640f3cd726ee2c04d9d422727ecafe59e55c253e6778e0948eabbc85845f762
Status: Downloaded newer image for oyahiroki/nlp4j-web-vectorsearch:1.0.0.0
docker.io/oyahiroki/nlp4j-web-vectorsearch:1.0.0.0
>
```

For detailed instructions, refer to the following article:  

https://qiita.com/oyahiroki/items/3f8a40c092322afa15c8

## 1-2. Installing and Running the Web Application

### Installation

```bash
docker pull oyahiroki/nlp4j-web-vectorsearch:1.0.0.0
```

### Execution

```bash
docker run -d --name nlp4j-web-vectorsearch -p 8983:8983 -p 8080:8080 oyahiroki/nlp4j-web-vectorsearch:1.0.0.0
```

### Opening in a Browser

```bash
http://localhost:8080/nlp4j-web-vectorsearch/
```

You should see a screen like the one below:

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/110265/374a5546-7975-0538-7bc3-0463399dd0e7.png)

For information about the image, refer to:  

https://hub.docker.com/r/oyahiroki/nlp4j-web-vectorsearch

# 2. Usage

## Storing Documents in the Vector Database

Enter any text into the text box and press "POST" to store it as a document.

## Vector Search in the Vector Database

Enter any text into the text box and press "Vector Search" to execute a vector-based search.

In the example below, you can see that "NY" and "ニューヨーク" (New York in Japanese Language) are appropriately matched.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/110265/822d5690-7c15-2d97-e7ab-acdc9efadc81.png)

# Miscellaneous

While the application is designed to run on environments with NVIDIA GPUs (with drivers installed), it has also been confirmed to work in non-NVIDIA environments.

---

[EOF]