From acf4cb57ac8c669b1845a7407e9beffff33ba291 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 03:46:21 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- comps/dataprep/milvus/langchain/README.md | 1 + comps/dataprep/milvus/langchain/prepare_doc_milvus.py | 6 +++--- comps/dataprep/milvus/langchain/set_env.sh | 3 +++ comps/retrievers/milvus/langchain/README.md | 5 +++-- comps/retrievers/milvus/langchain/set_env.sh | 4 +++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/comps/dataprep/milvus/langchain/README.md b/comps/dataprep/milvus/langchain/README.md index 8dd3b6b6b1..684a1f7af9 100644 --- a/comps/dataprep/milvus/langchain/README.md +++ b/comps/dataprep/milvus/langchain/README.md @@ -66,6 +66,7 @@ Update Knowledge Base via Local File nke-10k-2023.pdf. Get the file on a termina ``` wget https://raw.githubusercontent.com/opea-project/GenAIComps/main/comps/retrievers/redis/data/nke-10k-2023.pdf ``` + - Single file upload ```bash diff --git a/comps/dataprep/milvus/langchain/prepare_doc_milvus.py b/comps/dataprep/milvus/langchain/prepare_doc_milvus.py index 890b50bbab..5437abc75f 100644 --- a/comps/dataprep/milvus/langchain/prepare_doc_milvus.py +++ b/comps/dataprep/milvus/langchain/prepare_doc_milvus.py @@ -93,7 +93,7 @@ def ingest_chunks_to_milvus(file_name: str, chunks: List): batch_docs, embeddings, collection_name=COLLECTION_NAME, - connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri":url}, + connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri": url}, partition_key_field=partition_field_name, ) except Exception as e: @@ -212,7 +212,7 @@ async def ingest_documents( my_milvus = Milvus( embedding_function=embeddings, collection_name=COLLECTION_NAME, - connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri":url}, + connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri": url}, index_params=index_params, auto_id=True, ) @@ -408,7 +408,7 @@ async def delete_single_file(file_path: str = Body(..., embed=True)): my_milvus = Milvus( embedding_function=embeddings, collection_name=COLLECTION_NAME, - connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri":url}, + connection_args={"host": MILVUS_HOST, "port": MILVUS_PORT, "uri": url}, index_params=index_params, auto_id=True, ) diff --git a/comps/dataprep/milvus/langchain/set_env.sh b/comps/dataprep/milvus/langchain/set_env.sh index 4c9040fc15..791a467da0 100644 --- a/comps/dataprep/milvus/langchain/set_env.sh +++ b/comps/dataprep/milvus/langchain/set_env.sh @@ -1,3 +1,6 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + export DOCKER_VOLUME_DIRECTORY="../../../vectorstores/milvus" export host_ip=$(hostname -i) export no_proxy=${no_proxy},tei-embedding-service diff --git a/comps/retrievers/milvus/langchain/README.md b/comps/retrievers/milvus/langchain/README.md index 6bef1becbd..d0157440fd 100644 --- a/comps/retrievers/milvus/langchain/README.md +++ b/comps/retrievers/milvus/langchain/README.md @@ -8,7 +8,7 @@ You can start retriever Microservice either by Python script or docker composer. ```bash git clone https://github.com/opea-project/GenAIComps.git -cd GenAIComps/comps/retrievers/milvus/langchain +cd GenAIComps/comps/retrievers/milvus/langchain pip install -r requirements.txt ``` @@ -22,6 +22,7 @@ Please refer to this [readme](../../../vectorstores/milvus/README.md). export HUGGINGFACEHUB_API_TOKEN="YOUR_HUGGINGFACEHUB_API_TOKEN" #source set_env.sh ``` + ### Start Retriever Service ```bash @@ -35,7 +36,7 @@ python retriever_redis.py ```bash git clone https://github.com/opea-project/GenAIComps.git -cd GenAIComps/comps/retrievers/milvus/langchain +cd GenAIComps/comps/retrievers/milvus/langchain # build dataprep milvus docker image docker compose build --no-cache ``` diff --git a/comps/retrievers/milvus/langchain/set_env.sh b/comps/retrievers/milvus/langchain/set_env.sh index 7310732968..0721f0c1c7 100644 --- a/comps/retrievers/milvus/langchain/set_env.sh +++ b/comps/retrievers/milvus/langchain/set_env.sh @@ -1,3 +1,6 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + export host_ip=$(hostname -i) export DOCKER_VOLUME_DIRECTORY="../../../vectorstores/milvus" export no_proxy=${no_proxy},tei-embedding-service @@ -6,4 +9,3 @@ export MILVUS_HOST=${host_ip} export MILVUS_PORT=19530 # Optional COLLECTION_NAME export COLLECTION_NAME=${your_collection_name} -