Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f6e1b81
[Bug: 1379] Added Multimodal support for Milvus for retriever component
srajabos Mar 8, 2025
91d1cfd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 8, 2025
2bf9829
add text2cypher component (#1319)
jeanyu-habana Mar 10, 2025
d6cf153
Add Dockerfile for build ROCm vLLM Docker image (#1372)
chyundunovDatamonsters Mar 12, 2025
65ae16a
Filter none test scripts in test matrix (#1386)
chensuyue Mar 12, 2025
97d75f1
Use the latest HabanaAI/vllm-fork release tag to build vllm-gaudi ima…
chensuyue Mar 12, 2025
b99e658
[Bug: 1375] Fix Readme errors in dataprep component for all VectorDBs…
srajabos Mar 12, 2025
3924bf8
bridgetower/clip: add missing dependency for aiohttp (#1371)
lianhao Mar 12, 2025
221f234
Refine Dataprep Redis with Async Issue (#1390)
letonghan Mar 13, 2025
4543ebd
Fix file list and index drop for opensearch (#1322)
jonminkin97 Mar 13, 2025
5c05338
Fix dependency issue in Retriever (#1393)
letonghan Mar 14, 2025
022b53b
[Telemetry] use existed env variable instead of introducing new one (…
louie-tsai Mar 14, 2025
4b6416a
Add GitHub Action to check and close stale issues and PRs (#1394)
XuehaoSun Mar 14, 2025
3b252e0
enable custom prompt for react_llama and react_langgraph (#1391)
minmin-intel Mar 15, 2025
d14e347
Added the milvus multimodal tests
pallavijaini0525 Mar 17, 2025
015eb46
Merge branch 'main' into bug-1379
chensuyue Mar 18, 2025
a15988b
Removing the dockers after the test
pallavijaini0525 Mar 18, 2025
cb68d62
Merge branch 'main' into bug-1379
xiguiw Mar 26, 2025
ce6c842
Merge branch 'main' into bug-1379
srajabos Apr 1, 2025
3f75597
Merge branch 'main' into bug-1379
yinghu5 Apr 2, 2025
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
17 changes: 17 additions & 0 deletions comps/retrievers/deployment/docker_compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ services:
minio:
condition: service_healthy

retriever-milvus-multimodal:
extends: retriever
container_name: retriever-milvus-multimodal
environment:
RETRIEVER_COMPONENT_NAME: ${RETRIEVER_COMPONENT_NAME:-OPEA_RETRIEVER_MILVUS}
RETRIEVER_TYPE: ${RETRIEVER_TYPE:-milvus}
MILVUS_HOST: ${host_ip}
BRIDGE_TOWER_EMBEDDING: ${BRIDGE_TOWER_EMBEDDING}
COLLECTION_NAME: ${COLLECTION_NAME:-LangChainCollection}
depends_on:
standalone:
condition: service_healthy
etcd:
condition: service_healthy
minio:
condition: service_healthy

retriever-neo4j:
extends: retriever
container_name: retriever-neo4j
Expand Down
6 changes: 6 additions & 0 deletions comps/retrievers/src/integrations/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from comps import CustomLogger, EmbedDoc, OpeaComponent, OpeaComponentRegistry, ServiceType

from .config import (
BRIDGE_TOWER_EMBEDDING,
COLLECTION_NAME,
HUGGINGFACEHUB_API_TOKEN,
INDEX_PARAMS,
Expand Down Expand Up @@ -61,6 +62,11 @@ def _initialize_embedder(self):
embeddings = HuggingFaceInferenceAPIEmbeddings(
api_key=HUGGINGFACEHUB_API_TOKEN, model_name=model_id, api_url=TEI_EMBEDDING_ENDPOINT
)
elif BRIDGE_TOWER_EMBEDDING:
logger.info("use bridge tower embedding")
from comps.third_parties.bridgetower.src.bridgetower_embedding import BridgeTowerEmbedding

embeddings = BridgeTowerEmbedding()
else:
# create embeddings using local embedding model
if logflag:
Expand Down
73 changes: 72 additions & 1 deletion tests/retrievers/test_retrievers_milvus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LOG_PATH="$WORKPATH/tests"
export host_ip=$(hostname -I | awk '{print $1}')
service_name="retriever-milvus etcd minio standalone"
retriever_service_name="retriever-milvus"
service_name_mm="retriever-milvus-multimodal etcd minio standalone"

function build_docker_images() {
cd $WORKPATH
Expand Down Expand Up @@ -46,6 +47,23 @@ function start_service() {
sleep 1m
}

function start_multimodal_service() {
export MINIO_PORT1=11611
export MINIO_PORT2=11612
export MILVUS_STANDALONE_PORT=11613
export TEI_EMBEDDER_PORT=11614
export HF_TOKEN=${HF_TOKEN}
export COLLECTION_NAME="LangChainCollection"
export LOGFLAG=True
export BRIDGE_TOWER_EMBEDDING=true
export RETRIEVER_TYPE="milvus"

cd $WORKPATH/comps/retrievers/deployment/docker_compose
docker compose -f compose.yaml up ${service_name_mm} -d > ${LOG_PATH}/start_services_with_compose_multimodal.log

sleep 2m
}

function validate_microservice() {
local test_embedding="$1"

Expand All @@ -72,12 +90,57 @@ function validate_microservice() {
fi
}

function validate_mm_microservice() {
local test_embedding="$1"
local container_name="$2"

export PATH="${HOME}/miniforge3/bin:$PATH"
source activate
URL="http://${host_ip}:$RETRIEVER_PORT/v1/retrieval"

# Test the retriever with a b64 image that should be passed through
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST -d "{\"text\":\"test\",\"embedding\":${test_embedding},\"base64_image\":\"iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mP8/5+hnoEIwDiqkL4KAcT9GO0U4BxoAAAAAElFTkSuQmCC\"}" -H 'Content-Type: application/json' "$URL")
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "[ retriever ] HTTP status is 200. Checking content..."
local CONTENT=$(curl -s -X POST -d "{\"text\":\"test\",\"embedding\":${test_embedding}}" -H 'Content-Type: application/json' "$URL" | tee ${LOG_PATH}/retriever.log)

if echo "$CONTENT" | grep -q "retrieved_docs"; then
echo "[ retriever ] Content has retrieved_docs as expected."
empty_search_results=$(echo "$CONTENT" | grep "\"retrieved_docs\":\[\]")
if [ -z "$empty_search_results" ]; then
# If search results are not empty, check for b64 image string
if echo "$CONTENT" | grep -q "b64_img_str"; then
echo "[ retriever ] Content has b64_img_str as expected."
else
echo "[ retriever ] Content does not include the b64_img_str: $CONTENT"
docker logs ${container_name} >> ${LOG_PATH}/retriever.log
exit 1
fi
fi
else
echo "[ retriever ] Content does not match the expected result: $CONTENT"
docker logs ${container_name} >> ${LOG_PATH}/retriever.log
exit 1
fi
else
echo "[ retriever ] HTTP status is not 200. Received status was $HTTP_STATUS"
docker logs ${container_name} >> ${LOG_PATH}/retriever.log
exit 1
fi
}

function stop_docker() {
cd $WORKPATH/comps/third_parties/milvus/deployment/docker_compose/
docker compose -f compose.yaml down --remove-orphans

docker stop milvus-etcd
docker rm milvus-etcd

cd $WORKPATH/comps/retrievers/deployment/docker_compose
docker compose -f compose.yaml down --remove-orphans

docker compose -f compose.yaml down ${service_name} --remove-orphans
docker compose -f compose.yaml down ${service_name_mm} --remove-orphans

cid=$(docker ps -aq --filter "name=tei-embedding-serving")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
}
Expand All @@ -92,6 +155,14 @@ function main() {
validate_microservice "$test_embedding"

stop_docker

start_multimodal_service
test_embedding_multi=$(python -c "import random; embedding = [random.uniform(-1, 1) for _ in range(512)]; print(embedding)")
validate_microservice "$test_embedding_multi" "$service_name_mm"
validate_mm_microservice "$test_embedding_multi" "$service_name_mm"

stop_docker

echo y | docker system prune

}
Expand Down
Loading