Skip to content

Commit

Permalink
Merge branch 'main' into embeddings-comp
Browse files Browse the repository at this point in the history
  • Loading branch information
sharanshirodkar7 authored Sep 16, 2024
2 parents 5638034 + 29fe569 commit 9ab7265
Show file tree
Hide file tree
Showing 87 changed files with 1,572 additions and 436 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/_comps-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ permissions: read-all
on:
workflow_call:
inputs:
node:
required: true
type: string
service:
required: true
type: string
Expand Down Expand Up @@ -36,7 +33,7 @@ jobs:
# Image Build
####################################################################################################
build-images:
runs-on: "docker-build-${{ inputs.node }}"
runs-on: "docker-build-gaudi"
continue-on-error: true
outputs:
file_exists: ${{ steps.get-yaml-path.outputs.file_exists }}
Expand Down Expand Up @@ -84,10 +81,9 @@ jobs:
####################################################################################################
test-service-compose:
needs: [build-images]
if: ${{ fromJSON(inputs.test) && needs.build-images.outputs.file_exists == 'true' }}
if: ${{ fromJSON(inputs.test) }}
uses: ./.github/workflows/_run-docker-compose.yml
with:
tag: ${{ inputs.tag }}
service: ${{ inputs.service }}
hardware: ${{ inputs.node }}
secrets: inherit
12 changes: 4 additions & 8 deletions .github/workflows/_run-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ on:
description: Example to test
required: true
type: string
hardware:
description: Hardware to run the test on
required: true
type: string
jobs:
get-test-case:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -55,16 +51,17 @@ jobs:
set -x
service_l=$(echo ${{ inputs.service }} | tr '[:upper:]' '[:lower:]')
cd ${{ github.workspace }}/tests
test_cases=$(find . -type f -name "test_${service_l}*.sh" -print | cut -d/ -f2 | jq -R '.' | jq -sc '.')
test_cases=$(find . -type f -name "test_${service_l}*.sh" -print | jq -R '.' | jq -sc '.')
echo "test_cases=$test_cases" >> $GITHUB_OUTPUT
# TODO: get hardware for test matrix
run-test:
needs: [get-test-case]
strategy:
matrix:
test_case: ${{ fromJSON(needs.get-test-case.outputs.test_cases) }}
fail-fast: false
runs-on: ${{ inputs.hardware }}
runs-on: gaudi
continue-on-error: true
steps:
- name: Clean up Working Directory
Expand All @@ -88,11 +85,10 @@ jobs:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
PINECONE_KEY: ${{ secrets.PINECONE_KEY }}
service: ${{ inputs.service }}
hardware: ${{ inputs.hardware }}
test_case: ${{ matrix.test_case }}
run: |
cd ${{ github.workspace }}/tests
service=$(echo "${test_case}" | sed 's/test_\(.*\)\.sh/\1/')
service=$(echo "${test_case}" | cut -d'_' -f2- |cut -d'.' -f1)
echo "service=${service}" >> $GITHUB_ENV
if [ -f ${test_case} ]; then timeout 30m bash ${test_case}; else echo "Test script {${test_case}} not found, skip test!"; fi
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/docker/compose/dataprep-compose-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ services:
build:
dockerfile: comps/dataprep/pinecone/langchain/Dockerfile
image: ${REGISTRY:-opea}/dataprep-pinecone:${TAG:-latest}
dataprep-redis: #need to rename
dataprep-multimodal-redis:
build:
dockerfile: comps/dataprep/multimodal/redis/langchain/Dockerfile
image: ${REGISTRY:-opea}/dataprep-redis:${TAG:-latest}
dataprep-vdmsxx: #need to rename
image: ${REGISTRY:-opea}/dataprep-multimodal-redis:${TAG:-latest}
dataprep-vdms:
build:
dockerfile: comps/dataprep/vdms/langchain/Dockerfile
image: ${REGISTRY:-opea}/dataprep-vdms:${TAG:-latest}
dataprep-neo4j:
build:
dockerfile: comps/dataprep/neo4j/langchain/Dockerfile
image: ${REGISTRY:-opea}/dataprep-neo4j:${TAG:-latest}
4 changes: 2 additions & 2 deletions .github/workflows/docker/compose/dataprep-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
build:
dockerfile: comps/dataprep/redis/langchain_ray/Dockerfile
image: ${REGISTRY:-opea}/dataprep-on-ray-redis:${TAG:-latest}
dataprep-vdms:
dataprep-multimodal-vdms:
build:
dockerfile: comps/dataprep/vdms/multimodal_langchain/Dockerfile
image: ${REGISTRY:-opea}/dataprep-vdms:${TAG:-latest}
image: ${REGISTRY:-opea}/dataprep-multimodal-vdms:${TAG:-latest}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
build:
dockerfile: comps/embeddings/multimodal/bridgetower/Dockerfile.intel_hpu
image: ${REGISTRY:-opea}/bridgetower-embedder-gaudi:${TAG:-latest}
embedding-multimodalxx: #need to rename
embedding-multimodal:
build:
dockerfile: comps/embeddings/multimodal/multimodal_langchain/Dockerfile
image: ${REGISTRY:-opea}/embedding-multimodal:${TAG:-latest}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker/compose/embeddings-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
build:
dockerfile: comps/embeddings/tei/langchain/Dockerfile
image: ${REGISTRY:-opea}/embedding-tei:${TAG:-latest}
embedding-multimodal:
embedding-multimodal-clip:
build:
dockerfile: comps/embeddings/multimodal_clip/Dockerfile
image: ${REGISTRY:-opea}/embedding-multimodal:${TAG:-latest}
image: ${REGISTRY:-opea}/embedding-multimodal-clip:${TAG:-latest}
4 changes: 2 additions & 2 deletions .github/workflows/docker/compose/llms-compose-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ services:
context: vllm-openvino
dockerfile: Dockerfile.openvino
image: ${REGISTRY:-opea}/vllm-openvino:${TAG:-latest}
llm-nativexx: #need to rename
llm-eval:
build:
dockerfile: comps/llms/utils/lm-eval/Dockerfile
image: ${REGISTRY:-opea}/llm-native:${TAG:-latest}
image: ${REGISTRY:-opea}/llm-eval:${TAG:-latest}
llm-vllm-llamaindex:
build:
dockerfile: comps/llms/text-generation/vllm/llama_index/Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker/compose/reranks-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
build:
dockerfile: comps/reranks/tei/Dockerfile
image: ${REGISTRY:-opea}/reranking-tei:${TAG:-latest}
reranking-videoragqna:
reranking-videoqna:
build:
dockerfile: comps/reranks/video-rag-qna/Dockerfile
image: ${REGISTRY:-opea}/reranking-videoragqna:${TAG:-latest}
dockerfile: comps/reranks/videoqna/Dockerfile
image: ${REGISTRY:-opea}/reranking-videoqna:${TAG:-latest}
4 changes: 4 additions & 0 deletions .github/workflows/docker/compose/retrievers-compose-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ services:
build:
dockerfile: comps/retrievers/multimodal/redis/langchain/Dockerfile
image: ${REGISTRY:-opea}/multimodal-retriever-redis:${TAG:-latest}
retriever-neo4j:
build:
dockerfile: comps/retrievers/neo4j/langchain/Dockerfile
image: ${REGISTRY:-opea}/retriever-neo4j:${TAG:-latest}
1 change: 0 additions & 1 deletion .github/workflows/manual-comps-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
with:
service: ${{ matrix.service }}
tag: ${{ inputs.tag }}
node: gaudi
mode: ${{ inputs.mode }}
test: ${{ inputs.test }}
secrets: inherit
4 changes: 2 additions & 2 deletions comps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
AudioQnAGateway,
RetrievalToolGateway,
FaqGenGateway,
VideoRAGQnAGateway,
VideoQnAGateway,
VisualQnAGateway,
MultimodalRAGWithVideosGateway,
MultimodalQnAGateway,
)

# Telemetry
Expand Down
4 changes: 2 additions & 2 deletions comps/cores/mega/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class MegaServiceEndpoint(Enum):
CHAT_QNA = "/v1/chatqna"
AUDIO_QNA = "/v1/audioqna"
VISUAL_QNA = "/v1/visualqna"
VIDEO_RAG_QNA = "/v1/videoragqna"
VIDEO_RAG_QNA = "/v1/videoqna"
CODE_GEN = "/v1/codegen"
CODE_TRANS = "/v1/codetrans"
DOC_SUMMARY = "/v1/docsum"
SEARCH_QNA = "/v1/searchqna"
MULTIMODAL_RAG_WITH_VIDEOS = "/v1/mmragvideoqna"
MULTIMODAL_QNA = "/v1/multimodalqna"
TRANSLATION = "/v1/translation"
RETRIEVALTOOL = "/v1/retrievaltool"
FAQ_GEN = "/v1/faqgen"
Expand Down
12 changes: 6 additions & 6 deletions comps/cores/mega/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ async def handle_request(self, request: Request):
return ChatCompletionResponse(model="visualqna", choices=choices, usage=usage)


class VideoRAGQnAGateway(Gateway):
class VideoQnAGateway(Gateway):
def __init__(self, megaservice, host="0.0.0.0", port=8888):
super().__init__(
megaservice,
Expand Down Expand Up @@ -594,7 +594,7 @@ async def handle_request(self, request: Request):
finish_reason="stop",
)
)
return ChatCompletionResponse(model="videoragqna", choices=choices, usage=usage)
return ChatCompletionResponse(model="videoqna", choices=choices, usage=usage)


class RetrievalToolGateway(Gateway):
Expand Down Expand Up @@ -634,14 +634,14 @@ def parser_input(data, TypeClass, key):
return response


class MultimodalRAGWithVideosGateway(Gateway):
class MultimodalQnAGateway(Gateway):
def __init__(self, multimodal_rag_megaservice, lvm_megaservice, host="0.0.0.0", port=9999):
self.lvm_megaservice = lvm_megaservice
super().__init__(
multimodal_rag_megaservice,
host,
port,
str(MegaServiceEndpoint.MULTIMODAL_RAG_WITH_VIDEOS),
str(MegaServiceEndpoint.MULTIMODAL_QNA),
ChatCompletionRequest,
ChatCompletionResponse,
)
Expand Down Expand Up @@ -737,7 +737,7 @@ async def handle_request(self, request: Request):
data = await request.json()
stream_opt = bool(data.get("stream", False))
if stream_opt:
print("[ MultimodalRAGWithVideosGateway ] stream=True not used, this has not support streaming yet!")
print("[ MultimodalQnAGateway ] stream=True not used, this has not support streaming yet!")
stream_opt = False
chat_request = ChatCompletionRequest.model_validate(data)
# Multimodal RAG QnA With Videos has not yet accepts image as input during QnA.
Expand Down Expand Up @@ -803,4 +803,4 @@ async def handle_request(self, request: Request):
metadata=metadata,
)
)
return ChatCompletionResponse(model="multimodalragwithvideos", choices=choices, usage=usage)
return ChatCompletionResponse(model="multimodalqna", choices=choices, usage=usage)
6 changes: 3 additions & 3 deletions comps/dataprep/multimodal/redis/langchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token}

```bash
cd ../../../../
docker build -t opea/dataprep-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/multimodal/redis/langchain/Dockerfile .
docker build -t opea/dataprep-multimodal-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/multimodal/redis/langchain/Dockerfile .
```

### 2.5 Run Docker with CLI (Option A)

```bash
docker run -d --name="dataprep-redis-server" -p 6007:6007 --runtime=runc --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME -e LVM_ENDPOINT=$LVM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN opea/dataprep-redis:latest
docker run -d --name="dataprep-multimodal-redis" -p 6007:6007 --runtime=runc --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME -e LVM_ENDPOINT=$LVM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN opea/dataprep-multimodal-redis:latest
```

### 2.6 Run with Docker Compose (Option B - deprecated, will move to genAIExample in future)
Expand All @@ -102,7 +102,7 @@ docker compose -f docker-compose-dataprep-redis.yaml up -d
## 🚀3. Status Microservice

```bash
docker container logs -f dataprep-redis-server
docker container logs -f dataprep-multimodal-redis
```

## 🚀4. Consume Microservice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
ports:
- "6379:6379"
- "8001:8001"
dataprep-redis:
image: opea/dataprep-redis:latest
container_name: dataprep-redis-server
dataprep-multimodal-redis:
image: opea/dataprep-multimodal-redis:latest
container_name: dataprep-multimodal-redis
ports:
- "6007:6007"
ipc: host
Expand Down
38 changes: 38 additions & 0 deletions comps/dataprep/neo4j/langchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

FROM python:3.11-slim

ENV LANG=C.UTF-8

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
default-jre \
libgl1-mesa-glx \
libjemalloc-dev

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

USER user

COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip setuptools && \
if [ ${ARCH} = "cpu" ]; then pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu; fi && \
pip install --no-cache-dir -r /home/user/comps/dataprep/neo4j/langchain/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home/user

USER root

RUN mkdir -p /home/user/comps/dataprep/qdrant/langchain/uploaded_files && chown -R user /home/user/comps/dataprep/neo4j/langchain/uploaded_files

USER user

WORKDIR /home/user/comps/dataprep/neo4j/langchain

ENTRYPOINT ["python", "prepare_doc_neo4j.py"]
Loading

0 comments on commit 9ab7265

Please sign in to comment.