Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update retrieve and reranking README.md #101

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The initially supported microservices are described in the below table. More mic
<td><a href="./comps/embeddings/README.md">Embedding</a></td>
<td><a href="https://www.langchain.com">LangChain</a></td>
<td><a href="https://huggingface.co/BAAI/bge-large-en-v1.5">BAAI/bge-large-en-v1.5</a></td>
<td><a href="https://github.com/huggingface/tei-gaudi">TEI-Habana</a></td>
<td><a href="https://github.com/huggingface/tei-gaudi">TEI-Gaudi</a></td>
<td>Gaudi2</td>
<td>Embedding on Gaudi2</td>
</tr>
Expand All @@ -58,7 +58,7 @@ The initially supported microservices are described in the below table. More mic
<td><a href="./comps/reranks/README.md">Reranking</a></td>
<td><a href="https://www.langchain.com">LangChain</a></td>
<td><a href="https://huggingface.co/BAAI/bge-reranker-large">BAAI/bge-reranker-large</a></td>
<td><a href="https://github.com/huggingface/tei-gaudi">TEI-Habana</a></td>
<td><a href="https://github.com/huggingface/tei-gaudi">TEI-Gaudi</a></td>
<td>Gaudi2</td>
<td>Reranking on Gaudi2</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions comps/reranks/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Reranking Microservice

The Reranking Microservice, fueled by Rerank models, stands as a straightforward yet immensely potent tool for semantic search. When provided with a query and a collection of documents, Rerank swiftly indexes the documents based on their semantic relevance to the query, arranging them from most to least pertinent. This microservice significantly enhances overall accuracy. In a text retrieval system, either a dense embedding model or a sparse lexical search index is often employed to retrieve relevant text documents based on the input. However, a reranking model can further refine this process by rearranging potential candidates into a final, optimized order.
The Reranking Microservice, fueled by reranking models, stands as a straightforward yet immensely potent tool for semantic search. When provided with a query and a collection of documents, reranking swiftly indexes the documents based on their semantic relevance to the query, arranging them from most to least pertinent. This microservice significantly enhances overall accuracy. In a text retrieval system, either a dense embedding model or a sparse lexical search index is often employed to retrieve relevant text documents based on the input. However, a reranking model can further refine this process by rearranging potential candidates into a final, optimized order.

# 🚀Start Microservice with Python

To start the Reranking microservice, you need to install python packages first.
To start the Reranking microservice, you must first install the required python packages.

## Install Requirements

Expand Down Expand Up @@ -72,7 +72,7 @@ docker compose -f docker_compose_reranking.yaml up -d
## Check Service Status

```bash
curl http://localhost:8000/v1/health_check\
curl http://localhost:8000/v1/health_check \
-X GET \
-H 'Content-Type: application/json'
```
Expand Down
19 changes: 10 additions & 9 deletions comps/retrievers/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
# Retriever Microservice

This retriever microservice is a highly efficient search service designed for handling and retrieving embedding vectors. It operates by receiving an embedding vector as input and conducting a similarity search against vectors stored in a vectordb database. Users must specify the vectordb's URL and the index name, and the service searches within that index to find documents with the highest similarity to the input vector.
This retriever microservice is a highly efficient search service designed for handling and retrieving embedding vectors. It operates by receiving an embedding vector as input and conducting a similarity search against vectors stored in a VectorDB database. Users must specify the VectorDB's URL and the index name, and the service searches within that index to find documents with the highest similarity to the input vector.

The service primarily utilizes measures of similarity in vector space to rapidly retrieve documents that are contentually similar. This vector-based retrieval approach is particularly suited for handling large datasets, offering fast and accurate search results that significantly enhance the efficiency and quality of information retrieval.
The service primarily utilizes similarity measures in vector space to rapidly retrieve contentually similar documents. The vector-based retrieval approach is particularly suited for handling large datasets, offering fast and accurate search results that significantly enhance the efficiency and quality of information retrieval.

Overall, this microservice provides robust backend support for applications requiring efficient similarity searches, playing a vital role in scenarios such as recommendation systems, information retrieval, or any other context where precise measurement of document similarity is crucial.

# 🚀Start Microservice with Python

To start the retriever microservice, you need to install python packages first.
To start the retriever microservice, you must first install the required python packages.

## Install Requirements

```bash
pip install -r requirements.txt
```

## Setup Vectordb Service
## Setup VectorDB Service

You need to setup your own vectordb service (Redis in this example), and ingest your knowledge documents into the vector database.
You need to setup your own VectorDB service (Redis in this example), and ingest your knowledge documents into the vector database.

As for Redis, you could start a docker container using the following commands. Remember to ingest data into it manually.
As for Redis, you could start a docker container using the following commands.
Remember to ingest data into it manually.

```bash
docker run -d --name="redis-vector-db" -p 6379:6379 -p 8001:8001 redis/redis-stack:7.2.0-v9
Expand Down Expand Up @@ -70,14 +71,14 @@ docker compose -f docker_compose_retriever.yaml up -d
## Check Service Status

```bash
curl http://localhost:7000/v1/health_check\
curl http://localhost:7000/v1/health_check \
-X GET \
-H 'Content-Type: application/json'
```

## Consume Embedding Service

To consume the retriever microservice, you need to generate a mock embedding vector of length 768 in Python script:
To consume the Retriever Microservice, you need to generate a mock embedding vector of length 768 in Python script:

```Python
import random
Expand All @@ -88,7 +89,7 @@ print(embedding)
Then substitute your mock embedding vector for the `${your_embedding}` in the following cURL command:

```bash
curl http://${your_ip}:7000/v1/retrieval\
curl http://${your_ip}:7000/v1/retrieval \
-X POST \
-d '{"text":"What is the revenue of Nike in 2023?","embedding":${your_embedding}}' \
-H 'Content-Type: application/json'
Expand Down