Skip to content

Commit 2b68323

Browse files
authored
Rename videoragqna to videoqna to align with other examples (#680)
Signed-off-by: BaoHuiling <[email protected]>
1 parent 0458443 commit 2b68323

File tree

11 files changed

+28
-35
lines changed

11 files changed

+28
-35
lines changed

.github/workflows/docker/compose/reranks-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
build:
99
dockerfile: comps/reranks/tei/Dockerfile
1010
image: ${REGISTRY:-opea}/reranking-tei:${TAG:-latest}
11-
reranking-videoragqna:
11+
reranking-videoqna:
1212
build:
13-
dockerfile: comps/reranks/video-rag-qna/Dockerfile
14-
image: ${REGISTRY:-opea}/reranking-videoragqna:${TAG:-latest}
13+
dockerfile: comps/reranks/videoqna/Dockerfile
14+
image: ${REGISTRY:-opea}/reranking-videoqna:${TAG:-latest}

comps/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
AudioQnAGateway,
4747
RetrievalToolGateway,
4848
FaqGenGateway,
49-
VideoRAGQnAGateway,
49+
VideoQnAGateway,
5050
VisualQnAGateway,
5151
MultimodalRAGWithVideosGateway,
5252
)

comps/cores/mega/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class MegaServiceEndpoint(Enum):
3838
CHAT_QNA = "/v1/chatqna"
3939
AUDIO_QNA = "/v1/audioqna"
4040
VISUAL_QNA = "/v1/visualqna"
41-
VIDEO_RAG_QNA = "/v1/videoragqna"
41+
VIDEO_RAG_QNA = "/v1/videoqna"
4242
CODE_GEN = "/v1/codegen"
4343
CODE_TRANS = "/v1/codetrans"
4444
DOC_SUMMARY = "/v1/docsum"

comps/cores/mega/gateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ async def handle_request(self, request: Request):
548548
return ChatCompletionResponse(model="visualqna", choices=choices, usage=usage)
549549

550550

551-
class VideoRAGQnAGateway(Gateway):
551+
class VideoQnAGateway(Gateway):
552552
def __init__(self, megaservice, host="0.0.0.0", port=8888):
553553
super().__init__(
554554
megaservice,
@@ -594,7 +594,7 @@ async def handle_request(self, request: Request):
594594
finish_reason="stop",
595595
)
596596
)
597-
return ChatCompletionResponse(model="videoragqna", choices=choices, usage=usage)
597+
return ChatCompletionResponse(model="videoqna", choices=choices, usage=usage)
598598

599599

600600
class RetrievalToolGateway(Gateway):

comps/reranks/video-rag-qna/Dockerfile renamed to comps/reranks/videoqna/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ USER user
1515
COPY comps /home/user/comps
1616

1717
RUN pip install --no-cache-dir --upgrade pip && \
18-
pip install --no-cache-dir -r /home/user/comps/reranks/video-rag-qna/requirements.txt
18+
pip install --no-cache-dir -r /home/user/comps/reranks/videoqna/requirements.txt
1919

2020
ENV PYTHONPATH=$PYTHONPATH:/home/user
2121

22-
WORKDIR /home/user/comps/reranks/video-rag-qna
22+
WORKDIR /home/user/comps/reranks/videoqna
2323

2424
ENTRYPOINT ["python", "local_reranking.py"]

comps/reranks/video-rag-qna/README.md renamed to comps/reranks/videoqna/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Rerank Microservice
22

3-
This is a Docker-based microservice that do result rerank for VideoRAGQnA use case. Local rerank is used rather than rerank model.
3+
This is a Docker-based microservice that do result rerank for VideoQnA use case. Local rerank is used rather than rerank model.
44

5-
For the `VideoRAGQnA` usecase, during the data preparation phase, frames are extracted from videos and stored in a vector database. To identify the most relevant video, we count the occurrences of each video source among the retrieved data with rerank function `get_top_doc`. This sorts the video as a descending list of names, ranked by their degree of match with the query. Then we could send the `top_n` videos to the downstream LVM.
5+
For the `VideoQnA` usecase, during the data preparation phase, frames are extracted from videos and stored in a vector database. To identify the most relevant video, we count the occurrences of each video source among the retrieved data with rerank function `get_top_doc`. This sorts the video as a descending list of names, ranked by their degree of match with the query. Then we could send the `top_n` videos to the downstream LVM.
66

77
## 🚀1. Start Microservice with Docker
88

99
### 1.1 Build Images
1010

1111
```bash
1212
cd GenAIComps
13-
docker build --no-cache -t opea/reranking-videoragqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/video-rag-qna/Dockerfile .
13+
docker build --no-cache -t opea/reranking-videoqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/videoqna/Dockerfile .
1414
```
1515

1616
### 1.2 Start Rerank Service
1717

1818
```bash
19-
docker compose -f comps/reranks/video-rag-qna/docker/docker_compose_reranking.yaml up -d
19+
docker compose -f comps/reranks/videoqna/docker_compose_reranking.yaml up -d
2020
# wait until ready
21-
until docker logs reranking-videoragqna-server 2>&1 | grep -q "Uvicorn running on"; do
21+
until docker logs reranking-videoqna-server 2>&1 | grep -q "Uvicorn running on"; do
2222
sleep 2
2323
done
2424
```
2525

2626
Available configuration by environment variable:
2727

28-
- CHUNK_DURATION: target chunk duration, should be aligned with VideoRAGQnA dataprep. Default 10s.
28+
- CHUNK_DURATION: target chunk duration, should be aligned with VideoQnA dataprep. Default 10s.
2929

3030
## ✅ 2. Test
3131

@@ -57,6 +57,6 @@ The result should be:
5757

5858
```bash
5959
# remove the container
60-
cid=$(docker ps -aq --filter "name=reranking-videoragqna-server")
60+
cid=$(docker ps -aq --filter "name=reranking-videoqna-server")
6161
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
6262
```

comps/reranks/video-rag-qna/docker_compose_reranking.yaml renamed to comps/reranks/videoqna/docker_compose_reranking.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
services:
55
reranking:
6-
image: opea/reranking-videoragqna:latest
7-
container_name: reranking-videoragqna-server
6+
image: opea/reranking-videoqna:latest
7+
container_name: reranking-videoqna-server
88
ports:
99
- "8000:8000"
1010
ipc: host

comps/reranks/video-rag-qna/local_reranking.py renamed to comps/reranks/videoqna/local_reranking.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ def format_video_name(video_name):
7575

7676

7777
@register_microservice(
78-
name="opea_service@reranking_visual_rag",
78+
name="opea_service@reranking_videoqna",
7979
service_type=ServiceType.RERANK,
8080
endpoint="/v1/reranking",
8181
host="0.0.0.0",
8282
port=8000,
8383
input_datatype=SearchedMultimodalDoc,
8484
output_datatype=LVMVideoDoc,
8585
)
86-
@register_statistics(names=["opea_service@reranking_visual_rag"])
86+
@register_statistics(names=["opea_service@reranking_videoqna"])
8787
def reranking(input: SearchedMultimodalDoc) -> LVMVideoDoc:
8888
start = time.time()
8989
try:
@@ -110,10 +110,10 @@ def reranking(input: SearchedMultimodalDoc) -> LVMVideoDoc:
110110
# Handle any other exceptions with a generic server error response
111111
raise HTTPException(status_code=500, detail="An unexpected error occurred.")
112112

113-
statistics_dict["opea_service@reranking_visual_rag"].append_latency(time.time() - start, None)
113+
statistics_dict["opea_service@reranking_videoqna"].append_latency(time.time() - start, None)
114114

115115
return result
116116

117117

118118
if __name__ == "__main__":
119-
opea_microservices["opea_service@reranking_visual_rag"].start()
119+
opea_microservices["opea_service@reranking_videoqna"].start()

tests/cores/mega/test_service_orchestrator_with_videoragqnagateway.py renamed to tests/cores/mega/test_service_orchestrator_with_videoqnagateway.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@
66

77
from fastapi.responses import StreamingResponse
88

9-
from comps import (
10-
ServiceOrchestrator,
11-
ServiceType,
12-
TextDoc,
13-
VideoRAGQnAGateway,
14-
opea_microservices,
15-
register_microservice,
16-
)
9+
from comps import ServiceOrchestrator, ServiceType, TextDoc, VideoQnAGateway, opea_microservices, register_microservice
1710
from comps.cores.proto.docarray import LLMParams
1811

1912

@@ -51,7 +44,7 @@ def setUp(self):
5144

5245
self.service_builder.add(opea_microservices["s1"]).add(opea_microservices["s2"])
5346
self.service_builder.flow_to(self.s1, self.s2)
54-
self.gateway = VideoRAGQnAGateway(self.service_builder, port=9898)
47+
self.gateway = VideoQnAGateway(self.service_builder, port=9898)
5548

5649
def tearDown(self):
5750
self.s1.stop()

0 commit comments

Comments
 (0)