From 7ffaf247f74393cf0860b849e98da3dca0f639a4 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Fri, 16 Aug 2024 19:58:57 +0800 Subject: [PATCH 01/11] adapt GenAIExample test structure refine (#510) Signed-off-by: chensuyue --- .github/workflows/pr-examples-test.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr-examples-test.yml b/.github/workflows/pr-examples-test.yml index 92354c5c2..a1f41f9f6 100644 --- a/.github/workflows/pr-examples-test.yml +++ b/.github/workflows/pr-examples-test.yml @@ -41,26 +41,25 @@ jobs: env: HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }} run: | + cd ../ && rm -rf GenAIExamples git clone https://github.com/opea-project/GenAIExamples.git - cd ${{ github.workspace }}/GenAIExamples/ChatQnA/docker/gaudi - sed -i "s#:latest#:comps#g" compose.yaml - cat compose.yaml + cd GenAIExamples/ChatQnA/docker + cp -r ${{ github.workspace }}/../GenAIComps . - cd ${{ github.workspace }}/GenAIExamples/ChatQnA/tests - GenAIComps_dir=${{github.workspace}} + cd ../tests sed -i '/GenAIComps.git/d' test_chatqna_on_gaudi.sh - sed -i "s#cd GenAIComps#cd ${GenAIComps_dir}#g" test_chatqna_on_gaudi.sh - sed -i "s#docker build -t#docker build --no-cache -q -t#g" test_chatqna_on_gaudi.sh - sed -i "s#:latest#:comps#g" test_chatqna_on_gaudi.sh cat test_chatqna_on_gaudi.sh echo "Run test..." + export IMAGE_TAG="comps" timeout 50m bash test_chatqna_on_gaudi.sh + echo "LOG_PATH=$(pwd)/*.log" >> $GITHUB_ENV + - name: Clean up container if: cancelled() || failure() run: | - cd ${{ github.workspace }}/GenAIExamples/ChatQnA/docker/gaudi + cd ${{ github.workspace }}/../GenAIExamples/ChatQnA/docker/gaudi docker compose stop && docker compose rm -f docker system prune -f @@ -69,4 +68,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: "Examples-Test-Logs" - path: ${{ github.workspace }}/GenAIExamples/ChatQnA/tests/*.log + path: ${{ env.LOG_PATH }} From 10433364bb425c53fa96b302435bb3d6ebf61575 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Fri, 16 Aug 2024 20:11:30 +0800 Subject: [PATCH 02/11] add sudo in wf remove (#511) Signed-off-by: chensuyue --- .github/workflows/pr-examples-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-examples-test.yml b/.github/workflows/pr-examples-test.yml index a1f41f9f6..302d6f8e1 100644 --- a/.github/workflows/pr-examples-test.yml +++ b/.github/workflows/pr-examples-test.yml @@ -41,7 +41,7 @@ jobs: env: HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }} run: | - cd ../ && rm -rf GenAIExamples + cd ../ && sudo rm -rf GenAIExamples git clone https://github.com/opea-project/GenAIExamples.git cd GenAIExamples/ChatQnA/docker cp -r ${{ github.workspace }}/../GenAIComps . From 22075037a0c9b24bfd14fe8fc9f56a2830cc088a Mon Sep 17 00:00:00 2001 From: "Sun, Xuehao" Date: Fri, 16 Aug 2024 20:53:49 +0800 Subject: [PATCH 03/11] Fix requirement actions (#500) Signed-off-by: Sun, Xuehao --- .github/workflows/manual-freeze-requirements.yml | 2 +- .github/workflows/scripts/freeze_requirements.sh | 16 ++++++++++------ comps/chathistory/mongo/requirements.txt | 2 +- .../dataprep/redis/llama_index/requirements.txt | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/manual-freeze-requirements.yml b/.github/workflows/manual-freeze-requirements.yml index ff958bbb2..8f00ca423 100644 --- a/.github/workflows/manual-freeze-requirements.yml +++ b/.github/workflows/manual-freeze-requirements.yml @@ -34,5 +34,5 @@ jobs: - name: Commit changes run: | git add . - git commit -m "Freeze requirements" + git commit -s -m "Freeze requirements" git push diff --git a/.github/workflows/scripts/freeze_requirements.sh b/.github/workflows/scripts/freeze_requirements.sh index 7c3b1d18a..431dadaef 100644 --- a/.github/workflows/scripts/freeze_requirements.sh +++ b/.github/workflows/scripts/freeze_requirements.sh @@ -15,16 +15,20 @@ function freeze() { --output-file "$folder/freeze.txt" \ "$file" echo "::endgroup::" + if [[ -e "$folder/freeze.txt" ]]; then if [[ "$keep_origin_packages" == "true" ]]; then - sed -i '/^\s*#/d; s/#.*//; /^\s*$/d' "$file" - sed -i '/^\s*#/d; s/#.*//; /^\s*$/d' "$folder/freeze.txt" - - packages1=$(cut -d'=' -f1 "$file" | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g') + # fix corner cases + sed -i '/^\s*#/d; s/#.*//; /^\s*$/d; s/ //g' "$file" + sed -i '/^\s*#/d; s/#.*//; /^\s*$/d; s/ //g; s/huggingface-hub\[inference\]/huggingface-hub/g; s/uvicorn\[standard\]/uvicorn/g' "$folder/freeze.txt" + if grep -q '^transformers$' $file && ! grep -q '^transformers\[sentencepiece\]$' $file; then + sed -i "s/transformers\[sentencepiece\]/transformers/" "$folder/freeze.txt" + fi + packages1=$(tr '><' '=' <"$file" | cut -d'=' -f1 | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g') packages2=$(cut -d'=' -f1 "$folder/freeze.txt" | tr '[:upper:]' '[:lower:]' | sed 's/[-_]/-/g') common_packages=$(comm -12 <(echo "$packages2" | sort) <(echo "$packages1" | sort)) - - rm "$file" + grep '^git\+' "$file" >temp_file || touch temp_file + rm -rf "$file" && mv temp_file "$file" while IFS= read -r line; do package=$(echo "$line" | cut -d'=' -f1) package_transformed=$(echo "$package" | tr '[:upper:]' '[:lower:]' | sed 's/[_-]/-/g') diff --git a/comps/chathistory/mongo/requirements.txt b/comps/chathistory/mongo/requirements.txt index b0dec78c0..aa08f761a 100644 --- a/comps/chathistory/mongo/requirements.txt +++ b/comps/chathistory/mongo/requirements.txt @@ -1 +1 @@ -๏ปฟmotor==3.4.0 +motor==3.4.0 diff --git a/comps/dataprep/redis/llama_index/requirements.txt b/comps/dataprep/redis/llama_index/requirements.txt index bb2f38b44..ad75869c1 100644 --- a/comps/dataprep/redis/llama_index/requirements.txt +++ b/comps/dataprep/redis/llama_index/requirements.txt @@ -2,7 +2,7 @@ docarray[full] fastapi huggingface_hub langsmith -llama-index +llama-index llama-index-embeddings-huggingface==0.2.0 llama-index-readers-file llama-index-vector-stores-redis From 72a255303630d011c72f358b0a513f1161d2a589 Mon Sep 17 00:00:00 2001 From: Harsha Ramayanam Date: Fri, 16 Aug 2024 09:14:09 -0700 Subject: [PATCH 04/11] Fix image in docker compose yaml to use the built docker image tag from the README (#498) * Update README.md The `ray_serve:habana` doesn't exist (yet) in docker hub * Fixed the image in docker compose yaml Signed-off-by: Harsha Ramayanam --------- Signed-off-by: Harsha Ramayanam Co-authored-by: chen, suyue --- comps/llms/README.md | 2 +- comps/llms/text-generation/tgi/docker_compose_llm.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comps/llms/README.md b/comps/llms/README.md index 584f2ba12..9c3867f03 100644 --- a/comps/llms/README.md +++ b/comps/llms/README.md @@ -40,7 +40,7 @@ docker run -it --name vllm_service -p 8008:80 -e HF_TOKEN=${HUGGINGFACEHUB_API_T ```bash export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} export TRUST_REMOTE_CODE=True -docker run -it --runtime=habana --name ray_serve_service -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -p 8008:80 -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e TRUST_REMOTE_CODE=$TRUST_REMOTE_CODE ray_serve:habana /bin/bash -c "ray start --head && python api_server_openai.py --port_number 80 --model_id_or_path ${your_hf_llm_model} --chat_processor ${your_hf_chatprocessor}" +docker run -it --runtime=habana --name ray_serve_service -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -p 8008:80 -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e TRUST_REMOTE_CODE=$TRUST_REMOTE_CODE opea/llm-ray:latest /bin/bash -c "ray start --head && python api_server_openai.py --port_number 80 --model_id_or_path ${your_hf_llm_model} --chat_processor ${your_hf_chatprocessor}" ``` ## 1.3 Verify the LLM Service diff --git a/comps/llms/text-generation/tgi/docker_compose_llm.yaml b/comps/llms/text-generation/tgi/docker_compose_llm.yaml index c1ab98dcc..9551979a7 100644 --- a/comps/llms/text-generation/tgi/docker_compose_llm.yaml +++ b/comps/llms/text-generation/tgi/docker_compose_llm.yaml @@ -14,7 +14,7 @@ services: shm_size: 1g command: --model-id ${LLM_MODEL_ID} llm: - image: opea/gen-ai-comps:llm-tgi-server + image: opea/llm-tgi:latest container_name: llm-tgi-server ports: - "9000:9000" From 5bd8bda9466d91d1c43cae2a0c2c4942abce7985 Mon Sep 17 00:00:00 2001 From: David Kinder Date: Fri, 16 Aug 2024 20:54:51 -0700 Subject: [PATCH 05/11] doc: remove use of unknown highlight language (#489) This file use ```log but there's no such syntax highlight language. Leave it empty instead. Signed-off-by: David B. Kinder --- comps/vectorstores/langchain/chroma/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comps/vectorstores/langchain/chroma/README.md b/comps/vectorstores/langchain/chroma/README.md index d7399b8fb..c64b094f6 100644 --- a/comps/vectorstores/langchain/chroma/README.md +++ b/comps/vectorstores/langchain/chroma/README.md @@ -18,7 +18,7 @@ docker compose up -d Upon starting the server, you should see log outputs similar to the following: -```log +``` server-1 | Starting 'uvicorn chromadb.app:app' with args: --workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30 server-1 | INFO: [02-08-2024 07:03:19] Set chroma_server_nofile to 65536 server-1 | INFO: [02-08-2024 07:03:19] Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information. From 8eb8b6a44ed42c325441ef257b2ebdf0e3225404 Mon Sep 17 00:00:00 2001 From: "Wang, Kai Lawrence" <109344418+wangkl2@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:33:24 +0800 Subject: [PATCH 06/11] Add cmds to restart ollama service and add proxy settings while launching docker (#438) Signed-off-by: Wang, Kai Lawrence --- comps/llms/text-generation/ollama/README.md | 28 +++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/comps/llms/text-generation/ollama/README.md b/comps/llms/text-generation/ollama/README.md index 1ad636098..fc7de914e 100644 --- a/comps/llms/text-generation/ollama/README.md +++ b/comps/llms/text-generation/ollama/README.md @@ -15,17 +15,25 @@ Follow [these instructions](https://github.com/ollama/ollama) to set up and run Note: Special settings are necessary to pull models behind the proxy. -```bash -sudo vim /etc/systemd/system/ollama.service -``` +- Step1: Modify the ollama service configure file. -Add your proxy to the above configure file. + ```bash + sudo vim /etc/systemd/system/ollama.service + ``` -```markdown -[Service] -Environment="http_proxy=${your_proxy}" -Environment="https_proxy=${your_proxy}" -``` + Add your proxy to the above configure file. + + ```markdown + [Service] + Environment="http_proxy=${your_proxy}" + Environment="https_proxy=${your_proxy}" + ``` + +- Step2: Restart the ollama service. + ```bash + sudo systemctl daemon-reload + sudo systemctl restart ollama + ``` ## Usage @@ -56,7 +64,7 @@ docker build --no-cache -t opea/llm-ollama:latest --build-arg https_proxy=$https # Run the Ollama Microservice ```bash -docker run --network host opea/llm-ollama:latest +docker run --network host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/llm-ollama:latest ``` # Consume the Ollama Microservice From 2b14c637f41cdbaf4fdc117ede157355c96c3bab Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Sat, 17 Aug 2024 23:35:16 +0800 Subject: [PATCH 07/11] Fix waring. (#504) Signed-off-by: zepan --- tests/test_agent_langchain.sh | 2 +- tests/test_asr.sh | 4 ++-- tests/test_chathistory_mongo.sh | 2 +- tests/test_dataprep_milvus.sh | 4 ++-- tests/test_dataprep_pgvector.sh | 2 +- tests/test_dataprep_pinecone.sh | 2 +- tests/test_dataprep_qdrant_langchain.sh | 2 +- tests/test_dataprep_redis_langchain.sh | 2 +- tests/test_dataprep_redis_langchain_ray.sh | 2 +- tests/test_dataprep_redis_llama_index.sh | 2 +- tests/test_embeddings_langchain-mosec.sh | 4 ++-- tests/test_embeddings_langchain.sh | 2 +- tests/test_embeddings_llama_index.sh | 2 +- tests/test_guardrails_llama_guard.sh | 2 +- tests/test_guardrails_pii_detection.sh | 2 +- tests/test_llms_faq-generation_tgi.sh | 2 +- tests/test_llms_summarization_tgi.sh | 2 +- tests/test_llms_text-generation_native.sh | 2 +- tests/test_llms_text-generation_tgi.sh | 2 +- tests/test_llms_text-generation_vllm-openvino.sh | 2 +- tests/test_llms_text-generation_vllm-ray.sh | 4 ++-- tests/test_llms_text-generation_vllm.sh | 4 ++-- tests/test_lvms_llava.sh | 4 ++-- tests/test_lvms_tgi_llava_next.sh | 4 ++-- tests/test_prompt_registry_mongo.sh | 2 +- tests/test_reranks_fastrag.sh | 2 +- tests/test_reranks_langchain-mosec.sh | 4 ++-- tests/test_reranks_tei.sh | 2 +- tests/test_retrievers_haystack_qdrant.sh | 2 +- tests/test_retrievers_langchain_pgvector.sh | 2 +- tests/test_retrievers_langchain_pinecone.sh | 2 +- tests/test_retrievers_langchain_redis.sh | 2 +- tests/test_tts.sh | 4 ++-- tests/test_web_retrievers_langchain_chroma.sh | 2 +- 34 files changed, 43 insertions(+), 43 deletions(-) diff --git a/tests/test_agent_langchain.sh b/tests/test_agent_langchain.sh index c08024847..0c4db337e 100644 --- a/tests/test_agent_langchain.sh +++ b/tests/test_agent_langchain.sh @@ -13,7 +13,7 @@ function build_docker_images() { cd $WORKPATH echo $WORKPATH docker build --no-cache -t opea/comps-agent-langchain:comps -f comps/agent/langchain/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/comps-agent-langchain built fail" exit 1 else diff --git a/tests/test_asr.sh b/tests/test_asr.sh index 305202c10..7334a18f1 100644 --- a/tests/test_asr.sh +++ b/tests/test_asr.sh @@ -11,14 +11,14 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/whisper:comps -f comps/asr/whisper/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/whisper built fail" exit 1 else echo "opea/whisper built successful" fi docker build --no-cache -t opea/asr:comps -f comps/asr/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/asr built fail" exit 1 else diff --git a/tests/test_chathistory_mongo.sh b/tests/test_chathistory_mongo.sh index 41116f886..c821fc05e 100755 --- a/tests/test_chathistory_mongo.sh +++ b/tests/test_chathistory_mongo.sh @@ -18,7 +18,7 @@ function build_docker_images() { docker run -d -p 27017:27017 --name=test-comps-mongo mongo:latest docker build --no-cache -t opea/chathistory-mongo-server:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/chathistory/mongo/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/chathistory-mongo-server built fail" exit 1 else diff --git a/tests/test_dataprep_milvus.sh b/tests/test_dataprep_milvus.sh index 23f275712..727ef81e1 100644 --- a/tests/test_dataprep_milvus.sh +++ b/tests/test_dataprep_milvus.sh @@ -13,7 +13,7 @@ function build_docker_images() { echo $(pwd) # langchain mosec embedding image docker build --no-cache -t opea/langchain-mosec:comps --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -f comps/embeddings/langchain-mosec/mosec-docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/langchain-mosec built fail" exit 1 else @@ -21,7 +21,7 @@ function build_docker_images() { fi # dataprep milvus image docker build --no-cache -t opea/dataprep-milvus:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/milvus/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-milvus built fail" exit 1 else diff --git a/tests/test_dataprep_pgvector.sh b/tests/test_dataprep_pgvector.sh index 3ea3df9f8..ca5649fe9 100755 --- a/tests/test_dataprep_pgvector.sh +++ b/tests/test_dataprep_pgvector.sh @@ -17,7 +17,7 @@ function build_docker_images() { # build dataprep image for pgvector docker build --no-cache -t opea/dataprep-pgvector:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f $WORKPATH/comps/dataprep/pgvector/langchain/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-pgvector built fail" exit 1 else diff --git a/tests/test_dataprep_pinecone.sh b/tests/test_dataprep_pinecone.sh index 1930d2798..4d0f64fac 100755 --- a/tests/test_dataprep_pinecone.sh +++ b/tests/test_dataprep_pinecone.sh @@ -11,7 +11,7 @@ function build_docker_images() { # build dataprep image for pinecone docker build --no-cache -t opea/dataprep-pinecone:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f $WORKPATH/comps/dataprep/pinecone/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-pinecone built fail" exit 1 else diff --git a/tests/test_dataprep_qdrant_langchain.sh b/tests/test_dataprep_qdrant_langchain.sh index e112438fd..632d7e06f 100644 --- a/tests/test_dataprep_qdrant_langchain.sh +++ b/tests/test_dataprep_qdrant_langchain.sh @@ -13,7 +13,7 @@ function build_docker_images() { # dataprep qdrant image docker build --no-cache -t opea/dataprep-qdrant:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/qdrant/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-qdrant built fail" exit 1 else diff --git a/tests/test_dataprep_redis_langchain.sh b/tests/test_dataprep_redis_langchain.sh index 1a9831dc5..82c25b9d3 100644 --- a/tests/test_dataprep_redis_langchain.sh +++ b/tests/test_dataprep_redis_langchain.sh @@ -12,7 +12,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/dataprep-redis:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-redis built fail" exit 1 else diff --git a/tests/test_dataprep_redis_langchain_ray.sh b/tests/test_dataprep_redis_langchain_ray.sh index 0980eafc1..9b1303d90 100644 --- a/tests/test_dataprep_redis_langchain_ray.sh +++ b/tests/test_dataprep_redis_langchain_ray.sh @@ -12,7 +12,7 @@ function build_docker_images() { echo "Building the docker images" cd $WORKPATH docker build --no-cache -t opea/dataprep-on-ray-redis:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain_ray/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-on-ray-redis built fail" exit 1 else diff --git a/tests/test_dataprep_redis_llama_index.sh b/tests/test_dataprep_redis_llama_index.sh index 13f0daa26..a7d20160b 100644 --- a/tests/test_dataprep_redis_llama_index.sh +++ b/tests/test_dataprep_redis_llama_index.sh @@ -12,7 +12,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/dataprep-redis-llama-index:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/llama_index/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/dataprep-redis-llama-index built fail" exit 1 else diff --git a/tests/test_embeddings_langchain-mosec.sh b/tests/test_embeddings_langchain-mosec.sh index 0b6e6cc47..95858118b 100644 --- a/tests/test_embeddings_langchain-mosec.sh +++ b/tests/test_embeddings_langchain-mosec.sh @@ -11,7 +11,7 @@ function build_mosec_docker_images() { cd $WORKPATH echo $(pwd) docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --no-cache -t opea/embedding-langchain-mosec-endpoint:comps -f comps/embeddings/langchain-mosec/mosec-docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/embedding-langchain-mosec-endpoint built fail" exit 1 else @@ -23,7 +23,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --no-cache -t opea/embedding-langchain-mosec:comps -f comps/embeddings/langchain-mosec/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/embedding-langchain-mosec built fail" exit 1 else diff --git a/tests/test_embeddings_langchain.sh b/tests/test_embeddings_langchain.sh index caa7301ea..6c6241226 100644 --- a/tests/test_embeddings_langchain.sh +++ b/tests/test_embeddings_langchain.sh @@ -11,7 +11,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/embedding-tei:comps -f comps/embeddings/langchain/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/embedding-tei built fail" exit 1 else diff --git a/tests/test_embeddings_llama_index.sh b/tests/test_embeddings_llama_index.sh index 8e47e8bb6..048726044 100644 --- a/tests/test_embeddings_llama_index.sh +++ b/tests/test_embeddings_llama_index.sh @@ -12,7 +12,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/embedding-tei-llamaindex:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/llama_index/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/embedding-tei-llamaindex built fail" exit 1 else diff --git a/tests/test_guardrails_llama_guard.sh b/tests/test_guardrails_llama_guard.sh index 515ce2a69..0e7980384 100644 --- a/tests/test_guardrails_llama_guard.sh +++ b/tests/test_guardrails_llama_guard.sh @@ -12,7 +12,7 @@ function build_docker_images() { cd $WORKPATH docker pull ghcr.io/huggingface/tgi-gaudi:2.0.1 docker build --no-cache -t opea/guardrails-tgi:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/guardrails/llama_guard/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/guardrails-tgi built fail" exit 1 else diff --git a/tests/test_guardrails_pii_detection.sh b/tests/test_guardrails_pii_detection.sh index fef024a3d..178b6ea23 100644 --- a/tests/test_guardrails_pii_detection.sh +++ b/tests/test_guardrails_pii_detection.sh @@ -11,7 +11,7 @@ function build_docker_images() { echo "Start building docker images for microservice" cd $WORKPATH docker build --no-cache -t opea/guardrails-pii-detection:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/guardrails/pii_detection/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/guardrails-pii-detection built fail" exit 1 else diff --git a/tests/test_llms_faq-generation_tgi.sh b/tests/test_llms_faq-generation_tgi.sh index c36ea3430..de5ec3466 100755 --- a/tests/test_llms_faq-generation_tgi.sh +++ b/tests/test_llms_faq-generation_tgi.sh @@ -11,7 +11,7 @@ LOG_PATH="$WORKPATH/tests" function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/llm-faqgen-tgi:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/faq-generation/tgi/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-faqgen-tgi built fail" exit 1 else diff --git a/tests/test_llms_summarization_tgi.sh b/tests/test_llms_summarization_tgi.sh index bfab7a9f3..9d463d321 100644 --- a/tests/test_llms_summarization_tgi.sh +++ b/tests/test_llms_summarization_tgi.sh @@ -11,7 +11,7 @@ LOG_PATH="$WORKPATH/tests" function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/llm-tgi:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/summarization/tgi/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-tgi built fail" exit 1 else diff --git a/tests/test_llms_text-generation_native.sh b/tests/test_llms_text-generation_native.sh index 69517327e..f1e7fff63 100644 --- a/tests/test_llms_text-generation_native.sh +++ b/tests/test_llms_text-generation_native.sh @@ -14,7 +14,7 @@ function build_docker_images() { --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \ -t opea/llm-native:comps \ -f comps/llms/text-generation/native/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-native built fail" exit 1 else diff --git a/tests/test_llms_text-generation_tgi.sh b/tests/test_llms_text-generation_tgi.sh index dc8594811..b2956b12b 100644 --- a/tests/test_llms_text-generation_tgi.sh +++ b/tests/test_llms_text-generation_tgi.sh @@ -10,7 +10,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t opea/llm-tgi:comps -f comps/llms/text-generation/tgi/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-tgi built fail" exit 1 else diff --git a/tests/test_llms_text-generation_vllm-openvino.sh b/tests/test_llms_text-generation_vllm-openvino.sh index dc460d0aa..ac57b29d8 100755 --- a/tests/test_llms_text-generation_vllm-openvino.sh +++ b/tests/test_llms_text-generation_vllm-openvino.sh @@ -21,7 +21,7 @@ function build_container() { . \ --build-arg https_proxy=$https_proxy \ --build-arg http_proxy=$http_proxy - if $? ; then + if [ $? -ne 0 ]; then echo "vllm-openvino built fail" exit 1 else diff --git a/tests/test_llms_text-generation_vllm-ray.sh b/tests/test_llms_text-generation_vllm-ray.sh index ae9a42728..41433b27f 100644 --- a/tests/test_llms_text-generation_vllm-ray.sh +++ b/tests/test_llms_text-generation_vllm-ray.sh @@ -13,7 +13,7 @@ function build_docker_images() { docker build \ -f comps/llms/text-generation/vllm-ray/docker/Dockerfile.vllmray \ --no-cache -t opea/vllm_ray-habana:comps --network=host . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/vllm_ray-habana built fail" exit 1 else @@ -25,7 +25,7 @@ function build_docker_images() { docker build \ --no-cache -t opea/llm-vllm-ray:comps \ -f comps/llms/text-generation/vllm-ray/docker/Dockerfile.microservice . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-vllm-ray built fail" exit 1 else diff --git a/tests/test_llms_text-generation_vllm.sh b/tests/test_llms_text-generation_vllm.sh index 1aae114e8..0210f5075 100644 --- a/tests/test_llms_text-generation_vllm.sh +++ b/tests/test_llms_text-generation_vllm.sh @@ -14,7 +14,7 @@ function build_docker_images() { -f docker/Dockerfile.hpu \ --no-cache -t opea/vllm-hpu:comps \ --shm-size=128g . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/vllm-hpu built fail" exit 1 else @@ -26,7 +26,7 @@ function build_docker_images() { docker build \ --no-cache -t opea/llm-vllm:comps \ -f comps/llms/text-generation/vllm/docker/Dockerfile.microservice . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llm-vllm built fail" exit 1 else diff --git a/tests/test_lvms_llava.sh b/tests/test_lvms_llava.sh index 2e8f3cbd5..08f138e2f 100644 --- a/tests/test_lvms_llava.sh +++ b/tests/test_lvms_llava.sh @@ -11,14 +11,14 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/llava:comps -f comps/lvms/llava/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llava built fail" exit 1 else echo "opea/llava built successful" fi docker build --no-cache -t opea/lvm:comps -f comps/lvms/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/lvm built fail" exit 1 else diff --git a/tests/test_lvms_tgi_llava_next.sh b/tests/test_lvms_tgi_llava_next.sh index 5a654b4ec..c9b28f6d5 100644 --- a/tests/test_lvms_tgi_llava_next.sh +++ b/tests/test_lvms_tgi_llava_next.sh @@ -12,7 +12,7 @@ function build_docker_images() { echo $(pwd) git clone https://github.com/yuanwu2017/tgi-gaudi.git && cd tgi-gaudi && git checkout v2.0.4 docker build --no-cache -t opea/llava-tgi:comps . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/llava-tgi built fail" exit 1 else @@ -21,7 +21,7 @@ function build_docker_images() { cd .. docker build --no-cache -t opea/lvm-tgi:comps -f comps/lvms/Dockerfile_tgi . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/lvm-tgi built fail" exit 1 else diff --git a/tests/test_prompt_registry_mongo.sh b/tests/test_prompt_registry_mongo.sh index 66d0a5757..b5d976999 100644 --- a/tests/test_prompt_registry_mongo.sh +++ b/tests/test_prompt_registry_mongo.sh @@ -18,7 +18,7 @@ function build_docker_images() { docker run -d -p 27017:27017 --name=test-comps-mongo mongo:latest docker build --no-cache -t opea/promptregistry-mongo-server:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/prompt_registry/mongo/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/promptregistry-mongo-server built fail" exit 1 else diff --git a/tests/test_reranks_fastrag.sh b/tests/test_reranks_fastrag.sh index 0be7489af..7b0575523 100644 --- a/tests/test_reranks_fastrag.sh +++ b/tests/test_reranks_fastrag.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -t opea/reranking-fastrag:comps -f comps/reranks/fastrag/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/reranking-fastrag built fail" exit 1 else diff --git a/tests/test_reranks_langchain-mosec.sh b/tests/test_reranks_langchain-mosec.sh index e5d166516..d34957a4c 100644 --- a/tests/test_reranks_langchain-mosec.sh +++ b/tests/test_reranks_langchain-mosec.sh @@ -11,7 +11,7 @@ function build_mosec_docker_images() { cd $WORKPATH echo $(pwd) docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --no-cache -t opea/reranking-langchain-mosec-endpoint:comps -f comps/reranks/langchain-mosec/mosec-docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/reranking-langchain-mosec-endpoint built fail" exit 1 else @@ -23,7 +23,7 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --no-cache -t opea/reranking-langchain-mosec:comps -f comps/reranks/langchain-mosec/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/reranking-langchain-mosec built fail" exit 1 else diff --git a/tests/test_reranks_tei.sh b/tests/test_reranks_tei.sh index 611e4d437..0b146d81e 100644 --- a/tests/test_reranks_tei.sh +++ b/tests/test_reranks_tei.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/reranking-tei:comps -f comps/reranks/tei/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/reranking-tei built fail" exit 1 else diff --git a/tests/test_retrievers_haystack_qdrant.sh b/tests/test_retrievers_haystack_qdrant.sh index 364f63450..4fdfb13d6 100644 --- a/tests/test_retrievers_haystack_qdrant.sh +++ b/tests/test_retrievers_haystack_qdrant.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/retriever-qdrant:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/haystack/qdrant/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/retriever-qdrant built fail" exit 1 else diff --git a/tests/test_retrievers_langchain_pgvector.sh b/tests/test_retrievers_langchain_pgvector.sh index b28fb632e..41295eb5e 100755 --- a/tests/test_retrievers_langchain_pgvector.sh +++ b/tests/test_retrievers_langchain_pgvector.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/retriever-pgvector:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/pgvector/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/retriever-pgvector built fail" exit 1 else diff --git a/tests/test_retrievers_langchain_pinecone.sh b/tests/test_retrievers_langchain_pinecone.sh index 7fb105a94..d370fa92a 100755 --- a/tests/test_retrievers_langchain_pinecone.sh +++ b/tests/test_retrievers_langchain_pinecone.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/retriever-pinecone:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/pinecone/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/retriever-pinecone built fail" exit 1 else diff --git a/tests/test_retrievers_langchain_redis.sh b/tests/test_retrievers_langchain_redis.sh index 5f4460d2c..9d367ce25 100644 --- a/tests/test_retrievers_langchain_redis.sh +++ b/tests/test_retrievers_langchain_redis.sh @@ -11,7 +11,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/retriever-redis:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/redis/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/retriever-redis built fail" exit 1 else diff --git a/tests/test_tts.sh b/tests/test_tts.sh index 3ae6f8c1d..e4039d956 100644 --- a/tests/test_tts.sh +++ b/tests/test_tts.sh @@ -11,14 +11,14 @@ function build_docker_images() { cd $WORKPATH echo $(pwd) docker build --no-cache -t opea/speecht5:comps -f comps/tts/speecht5/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/speecht5 built fail" exit 1 else echo "opea/speecht5 built successful" fi docker build --no-cache -t opea/tts:comps -f comps/tts/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/tts built fail" exit 1 else diff --git a/tests/test_web_retrievers_langchain_chroma.sh b/tests/test_web_retrievers_langchain_chroma.sh index 37e0dd4ea..c9e20aa08 100644 --- a/tests/test_web_retrievers_langchain_chroma.sh +++ b/tests/test_web_retrievers_langchain_chroma.sh @@ -9,7 +9,7 @@ ip_address=$(hostname -I | awk '{print $1}') function build_docker_images() { cd $WORKPATH docker build --no-cache -t opea/web-retriever-chroma:comps --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/web_retrievers/langchain/chroma/docker/Dockerfile . - if $? ; then + if [ $? -ne 0 ]; then echo "opea/web-retriever-chroma built fail" exit 1 else From b271739838fbcc5be87494f7b27c49865ac259ac Mon Sep 17 00:00:00 2001 From: Harsha Ramayanam Date: Sat, 17 Aug 2024 08:38:46 -0700 Subject: [PATCH 08/11] Update README.md (#482) Co-authored-by: Abolfazl Shahbazi From 77e0e7be1c596679a7e19a97ac33fbee2acf7cf7 Mon Sep 17 00:00:00 2001 From: David Kinder Date: Sat, 17 Aug 2024 08:43:12 -0700 Subject: [PATCH 09/11] doc: fix multiple H1 headings (#481) Only one H1 heading (first for the title) allowed. Signed-off-by: David B. Kinder Co-authored-by: chen, suyue --- comps/agent/langchain/README.md | 16 ++--- comps/asr/README.md | 24 +++---- comps/chathistory/mongo/README.md | 8 +-- comps/dataprep/README.md | 10 +-- comps/dataprep/milvus/README.md | 18 +++--- comps/dataprep/pgvector/README.md | 30 ++++----- comps/dataprep/pinecone/README.md | 22 +++---- comps/dataprep/qdrant/README.md | 22 +++---- comps/dataprep/redis/README.md | 34 +++++----- comps/embeddings/README.md | 30 ++++----- comps/embeddings/langchain-mosec/README.md | 8 +-- comps/guardrails/llama_guard/README.md | 26 ++++---- comps/guardrails/pii_detection/README.md | 22 +++---- comps/knowledgegraphs/README.md | 18 +++--- comps/llms/README.md | 64 +++++++++---------- comps/llms/faq-generation/tgi/README.md | 16 ++--- comps/llms/summarization/tgi/README.md | 26 ++++---- comps/llms/text-generation/ollama/README.md | 16 ++--- comps/llms/text-generation/tgi/README.md | 28 ++++---- comps/llms/text-generation/vllm-xft/README.md | 14 ++-- comps/lvms/README.md | 24 +++---- comps/prompt_registry/mongo/README.md | 8 +-- comps/reranks/README.md | 26 ++++---- comps/reranks/fastrag/README.md | 22 +++---- comps/reranks/langchain-mosec/README.md | 8 +-- comps/retrievers/haystack/qdrant/README.md | 24 +++---- comps/retrievers/langchain/README.md | 6 +- comps/retrievers/langchain/milvus/README.md | 22 +++---- comps/retrievers/langchain/pgvector/README.md | 28 ++++---- comps/retrievers/langchain/redis/README.md | 28 ++++---- comps/retrievers/llamaindex/README.md | 24 +++---- comps/tts/README.md | 16 ++--- comps/vectorstores/README.md | 8 +-- comps/vectorstores/langchain/chroma/README.md | 6 +- .../web_retrievers/langchain/chroma/README.md | 10 +-- 35 files changed, 357 insertions(+), 355 deletions(-) diff --git a/comps/agent/langchain/README.md b/comps/agent/langchain/README.md index 286e95508..b48e393eb 100644 --- a/comps/agent/langchain/README.md +++ b/comps/agent/langchain/README.md @@ -4,32 +4,32 @@ The langchain agent model refers to a framework that integrates the reasoning ca ![Architecture Overview](agent_arch.jpg) -# ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ +## ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash cd comps/agent/langchain/ pip install -r requirements.txt ``` -## 1.2 Start Microservice with Python Script +### 1.2 Start Microservice with Python Script ```bash cd comps/agent/langchain/ python agent.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## Build Microservices +### Build Microservices ```bash cd GenAIComps/ # back to GenAIComps/ folder docker build -t opea/comps-agent-langchain:latest -f comps/agent/langchain/docker/Dockerfile . ``` -## start microservices +### start microservices ```bash export ip_address=$(hostname -I | awk '{print $1}') @@ -56,7 +56,7 @@ docker logs comps-langchain-agent-endpoint > docker run --rm --runtime=runc --name="comps-langchain-agent-endpoint" -v ./comps/agent/langchain/:/home/user/comps/agent/langchain/ -p 9090:9090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} --env-file ${agent_env} opea/comps-agent-langchain:latest > ``` -# ๐Ÿš€3. Validate Microservice +## ๐Ÿš€3. Validate Microservice Once microservice starts, user can use below script to invoke. @@ -73,7 +73,7 @@ data: [DONE] ``` -# ๐Ÿš€4. Provide your own tools +## ๐Ÿš€4. Provide your own tools - Define tools diff --git a/comps/asr/README.md b/comps/asr/README.md index 4cf78cbf1..10cac9421 100644 --- a/comps/asr/README.md +++ b/comps/asr/README.md @@ -2,17 +2,17 @@ ASR (Audio-Speech-Recognition) microservice helps users convert speech to text. When building a talking bot with LLM, users will need to convert their audio inputs (What they talk, or Input audio from other sources) to text, so the LLM is able to tokenize the text and generate an answer. This microservice is built for that conversion stage. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the ASR microservice with Python, you need to first install python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start Whisper Service/Test +### 1.2 Start Whisper Service/Test - Xeon CPU @@ -40,7 +40,7 @@ nohup python whisper_server.py --device=hpu & python check_whisper_server.py ``` -## 1.3 Start ASR Service/Test +### 1.3 Start ASR Service/Test ```bash cd ../ @@ -54,13 +54,13 @@ While the Whisper service is running, you can start the ASR service. If the ASR {'id': '0e686efd33175ce0ebcf7e0ed7431673', 'text': 'who is pat gelsinger'} ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) Alternatively, you can also start the ASR microservice with Docker. -## 2.1 Build Images +### 2.1 Build Images -### 2.1.1 Whisper Server Image +#### 2.1.1 Whisper Server Image - Xeon CPU @@ -76,15 +76,15 @@ cd ../.. docker build -t opea/whisper-gaudi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/whisper/Dockerfile_hpu . ``` -### 2.1.2 ASR Service Image +#### 2.1.2 ASR Service Image ```bash docker build -t opea/asr:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/Dockerfile . ``` -## 2.2 Start Whisper and ASR Service +### 2.2 Start Whisper and ASR Service -### 2.2.1 Start Whisper Server +#### 2.2.1 Start Whisper Server - Xeon @@ -98,7 +98,7 @@ docker run -p 7066:7066 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$htt docker run -p 7066:7066 --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/whisper-gaudi:latest ``` -### 2.2.2 Start ASR service +#### 2.2.2 Start ASR service ```bash ip_address=$(hostname -I | awk '{print $1}') @@ -106,7 +106,7 @@ ip_address=$(hostname -I | awk '{print $1}') docker run -d -p 9099:9099 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e ASR_ENDPOINT=http://$ip_address:7066 opea/asr:latest ``` -### 2.2.3 Test +#### 2.2.3 Test ```bash # Use curl or python diff --git a/comps/chathistory/mongo/README.md b/comps/chathistory/mongo/README.md index 2eaa62e55..6f3f7a93a 100644 --- a/comps/chathistory/mongo/README.md +++ b/comps/chathistory/mongo/README.md @@ -17,16 +17,16 @@ export DB_NAME=${DB_NAME} export COLLECTION_NAME=${COLLECTION_NAME} ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../../../ docker build -t opea/chathistory-mongo-server:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/chathistory/mongo/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI - Run mongoDB image @@ -40,7 +40,7 @@ docker run -d -p 27017:27017 --name=mongo mongo:latest docker run -d --name="chathistory-mongo-server" -p 6013:6013 -p 6012:6012 -p 6014:6014 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/chathistory-mongo-server:latest ``` -# Invoke Microservice +## Invoke Microservice Once chathistory service is up and running, users can update the database by using the below API endpoint. The API returns a unique UUID for the saved conversation. diff --git a/comps/dataprep/README.md b/comps/dataprep/README.md index 46e5e3c0f..7c3873794 100644 --- a/comps/dataprep/README.md +++ b/comps/dataprep/README.md @@ -17,22 +17,22 @@ Occasionally unstructured data will contain image data, to convert the image dat export SUMMARIZE_IMAGE_VIA_LVM=1 ``` -# Dataprep Microservice with Redis +## Dataprep Microservice with Redis For details, please refer to this [readme](redis/README.md) -# Dataprep Microservice with Milvus +## Dataprep Microservice with Milvus For details, please refer to this [readme](milvus/README.md) -# Dataprep Microservice with Qdrant +## Dataprep Microservice with Qdrant For details, please refer to this [readme](qdrant/README.md) -# Dataprep Microservice with Pinecone +## Dataprep Microservice with Pinecone For details, please refer to this [readme](pinecone/README.md) -# Dataprep Microservice with PGVector +## Dataprep Microservice with PGVector For details, please refer to this [readme](pgvector/README.md) diff --git a/comps/dataprep/milvus/README.md b/comps/dataprep/milvus/README.md index 738869a82..9941dbaa6 100644 --- a/comps/dataprep/milvus/README.md +++ b/comps/dataprep/milvus/README.md @@ -1,8 +1,8 @@ # Dataprep Microservice with Milvus -# ๐Ÿš€Start Microservice with Python +## ๐Ÿš€Start Microservice with Python -## Install Requirements +### Install Requirements ```bash pip install -r requirements.txt @@ -11,11 +11,11 @@ apt-get install libtesseract-dev -y apt-get install poppler-utils -y ``` -## Start Milvus Server +### Start Milvus Server Please refer to this [readme](../../../vectorstores/langchain/milvus/README.md). -## Setup Environment Variables +### Setup Environment Variables ```bash export no_proxy=${your_no_proxy} @@ -27,7 +27,7 @@ export COLLECTION_NAME=${your_collection_name} export MOSEC_EMBEDDING_ENDPOINT=${your_embedding_endpoint} ``` -## Start Document Preparation Microservice for Milvus with Python Script +### Start Document Preparation Microservice for Milvus with Python Script Start document preparation microservice for Milvus with below command. @@ -35,22 +35,22 @@ Start document preparation microservice for Milvus with below command. python prepare_doc_milvus.py ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../../../ docker build -t opea/dataprep-milvus:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy --build-arg no_proxy=$no_proxy -f comps/dataprep/milvus/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI ```bash docker run -d --name="dataprep-milvus-server" -p 6010:6010 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MOSEC_EMBEDDING_ENDPOINT=${your_embedding_endpoint} -e MILVUS=${your_milvus_host_ip} opea/dataprep-milvus:latest ``` -# Invoke Microservice +## Invoke Microservice Once document preparation microservice for Milvus is started, user can use below command to invoke the microservice to convert the document to embedding and save to the database. diff --git a/comps/dataprep/pgvector/README.md b/comps/dataprep/pgvector/README.md index af25ae56d..1a7772eb8 100644 --- a/comps/dataprep/pgvector/README.md +++ b/comps/dataprep/pgvector/README.md @@ -1,14 +1,14 @@ # Dataprep Microservice with PGVector -# ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ +## ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Setup Environment Variables +### 1.2 Setup Environment Variables ```bash export PG_CONNECTION_STRING=postgresql+psycopg2://testuser:testpwd@${your_ip}:5432/vectordb @@ -18,11 +18,11 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/gen-ai-comps:dataprep" ``` -## 1.3 Start PGVector +### 1.3 Start PGVector Please refer to this [readme](../../vectorstores/langchain/pgvector/README.md). -## 1.4 Start Document Preparation Microservice for PGVector with Python Script +### 1.4 Start Document Preparation Microservice for PGVector with Python Script Start document preparation microservice for PGVector with below command. @@ -30,13 +30,13 @@ Start document preparation microservice for PGVector with below command. python prepare_doc_pgvector.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Start PGVector +### 2.1 Start PGVector Please refer to this [readme](../../vectorstores/langchain/pgvector/README.md). -## 2.2 Setup Environment Variables +### 2.2 Setup Environment Variables ```bash export PG_CONNECTION_STRING=postgresql+psycopg2://testuser:testpwd@${your_ip}:5432/vectordb @@ -46,29 +46,29 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/dataprep" ``` -## 2.3 Build Docker Image +### 2.3 Build Docker Image ```bash cd GenAIComps docker build -t opea/dataprep-pgvector:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/pgvector/langchain/docker/Dockerfile . ``` -## 2.4 Run Docker with CLI (Option A) +### 2.4 Run Docker with CLI (Option A) ```bash docker run --name="dataprep-pgvector" -p 6007:6007 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e PG_CONNECTION_STRING=$PG_CONNECTION_STRING -e INDEX_NAME=$INDEX_NAME -e TEI_ENDPOINT=$TEI_ENDPOINT opea/dataprep-pgvector:latest ``` -## 2.5 Run with Docker Compose (Option B) +### 2.5 Run with Docker Compose (Option B) ```bash cd comps/dataprep/langchain/pgvector/docker docker compose -f docker-compose-dataprep-pgvector.yaml up -d ``` -# ๐Ÿš€3. Consume Microservice +## ๐Ÿš€3. Consume Microservice -## 3.1 Consume Upload API +### 3.1 Consume Upload API Once document preparation microservice for PGVector is started, user can use below command to invoke the microservice to convert the document to embedding and save to the database. @@ -79,7 +79,7 @@ curl -X POST \ http://localhost:6007/v1/dataprep ``` -## 3.2 Consume get_file API +### 3.2 Consume get_file API To get uploaded file structures, use the following command: @@ -108,7 +108,7 @@ Then you will get the response JSON like this: ] ``` -## 4.3 Consume delete_file API +### 4.3 Consume delete_file API To delete uploaded file/link, use the following command. diff --git a/comps/dataprep/pinecone/README.md b/comps/dataprep/pinecone/README.md index 3a9f6fc30..42e3d048a 100644 --- a/comps/dataprep/pinecone/README.md +++ b/comps/dataprep/pinecone/README.md @@ -1,18 +1,18 @@ # Dataprep Microservice with Pinecone -# ๐Ÿš€Start Microservice with Python +## ๐Ÿš€Start Microservice with Python -## Install Requirements +### Install Requirements ```bash pip install -r requirements.txt ``` -## Start Pinecone Server +### Start Pinecone Server Please refer to this [readme](../../../vectorstores/langchain/pinecone/README.md). -## Setup Environment Variables +### Setup Environment Variables ```bash export http_proxy=${your_http_proxy} @@ -21,7 +21,7 @@ export PINECONE_API_KEY=${PINECONE_API_KEY} export PINECONE_INDEX_NAME=${PINECONE_INDEX_NAME} ``` -## Start Document Preparation Microservice for Pinecone with Python Script +### Start Document Preparation Microservice for Pinecone with Python Script Start document preparation microservice for Pinecone with below command. @@ -29,22 +29,22 @@ Start document preparation microservice for Pinecone with below command. python prepare_doc_pinecone.py ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../../../ docker build -t opea/dataprep-pinecone:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/pinecone/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI ```bash docker run -d --name="dataprep-pinecone-server" -p 6000:6000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/dataprep-pinecone:latest ``` -## Setup Environment Variables +### Setup Environment Variables ```bash export http_proxy=${your_http_proxy} @@ -53,14 +53,14 @@ export PINECONE_API_KEY=${PINECONE_API_KEY} export PINECONE_INDEX_NAME=${PINECONE_INDEX_NAME} ``` -## Run Docker with Docker Compose +### Run Docker with Docker Compose ```bash cd comps/dataprep/pinecone/docker docker compose -f docker-compose-dataprep-pinecone.yaml up -d ``` -# Invoke Microservice +## Invoke Microservice Once document preparation microservice for Pinecone is started, user can use below command to invoke the microservice to convert the document to embedding and save to the database. diff --git a/comps/dataprep/qdrant/README.md b/comps/dataprep/qdrant/README.md index 30aefb43d..4b52eaeeb 100644 --- a/comps/dataprep/qdrant/README.md +++ b/comps/dataprep/qdrant/README.md @@ -1,8 +1,8 @@ # Dataprep Microservice with Qdrant -# ๐Ÿš€Start Microservice with Python +## ๐Ÿš€Start Microservice with Python -## Install Requirements +### Install Requirements ```bash pip install -r requirements.txt @@ -11,11 +11,11 @@ apt-get install libtesseract-dev -y apt-get install poppler-utils -y ``` -## Start Qdrant Server +### Start Qdrant Server Please refer to this [readme](../../vectorstores/langchain/qdrant/README.md). -## Setup Environment Variables +### Setup Environment Variables ```bash export no_proxy=${your_no_proxy} @@ -27,7 +27,7 @@ export COLLECTION_NAME=${your_collection_name} export PYTHONPATH=${path_to_comps} ``` -## Start Document Preparation Microservice for Qdrant with Python Script +### Start Document Preparation Microservice for Qdrant with Python Script Start document preparation microservice for Qdrant with below command. @@ -35,22 +35,22 @@ Start document preparation microservice for Qdrant with below command. python prepare_doc_qdrant.py ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../../../ docker build -t opea/dataprep-qdrant:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/qdrant/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI ```bash docker run -d --name="dataprep-qdrant-server" -p 6007:6007 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/dataprep-qdrant:latest ``` -## Setup Environment Variables +### Setup Environment Variables ```bash export http_proxy=${your_http_proxy} @@ -60,14 +60,14 @@ export QDRANT_PORT=6333 export COLLECTION_NAME=${your_collection_name} ``` -## Run Docker with Docker Compose +### Run Docker with Docker Compose ```bash cd comps/dataprep/qdrant/docker docker compose -f docker-compose-dataprep-qdrant.yaml up -d ``` -# Invoke Microservice +## Invoke Microservice Once document preparation microservice for Qdrant is started, user can use below command to invoke the microservice to convert the document to embedding and save to the database. diff --git a/comps/dataprep/redis/README.md b/comps/dataprep/redis/README.md index 0845254df..4617dfa25 100644 --- a/comps/dataprep/redis/README.md +++ b/comps/dataprep/redis/README.md @@ -4,9 +4,9 @@ For dataprep microservice, we provide two frameworks: `Langchain` and `LlamaInde We organized these two folders in the same way, so you can use either framework for dataprep microservice with the following constructions. -# ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ +## ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ -## 1.1 Install Requirements +### 1.1 Install Requirements - option 1: Install Single-process version (for 1-10 files processing) @@ -29,11 +29,11 @@ pip install -r requirements.txt cd langchain_ray; pip install -r requirements_ray.txt ``` -## 1.2 Start Redis Stack Server +### 1.2 Start Redis Stack Server Please refer to this [readme](../../vectorstores/langchain/redis/README.md). -## 1.3 Setup Environment Variables +### 1.3 Setup Environment Variables ```bash export REDIS_URL="redis://${your_ip}:6379" @@ -41,7 +41,7 @@ export INDEX_NAME=${your_index_name} export PYTHONPATH=${path_to_comps} ``` -## 1.4 Start Embedding Service +### 1.4 Start Embedding Service First, you need to start a TEI service. @@ -67,7 +67,7 @@ After checking that it works, set up environment variables. export TEI_ENDPOINT="http://localhost:$your_port" ``` -## 1.4 Start Document Preparation Microservice for Redis with Python Script +### 1.4 Start Document Preparation Microservice for Redis with Python Script Start document preparation microservice for Redis with below command. @@ -83,13 +83,13 @@ python prepare_doc_redis.py python prepare_doc_redis_on_ray.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Start Redis Stack Server +### 2.1 Start Redis Stack Server Please refer to this [readme](../../vectorstores/langchain/redis/README.md). -## 2.2 Setup Environment Variables +### 2.2 Setup Environment Variables ```bash export EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" @@ -99,7 +99,7 @@ export INDEX_NAME=${your_index_name} export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} ``` -## 2.3 Build Docker Image +### 2.3 Build Docker Image - Build docker image with langchain @@ -124,7 +124,7 @@ cd ../../../../ docker build -t opea/dataprep-on-ray-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain_ray/docker/Dockerfile . ``` -## 2.4 Run Docker with CLI (Option A) +### 2.4 Run Docker with CLI (Option A) - option 1: Start single-process version (for 1-10 files processing) @@ -138,7 +138,7 @@ docker run -d --name="dataprep-redis-server" -p 6007:6007 --runtime=runc --ipc=h 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 TEI_ENDPOINT=$TEI_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e TIMEOUT_SECONDS=600 opea/dataprep-on-ray-redis:latest ``` -## 2.5 Run with Docker Compose (Option B - deprecated, will move to genAIExample in future) +### 2.5 Run with Docker Compose (Option B - deprecated, will move to genAIExample in future) ```bash # for langchain @@ -148,15 +148,15 @@ cd comps/dataprep/redis/llama_index/docker docker compose -f docker-compose-dataprep-redis.yaml up -d ``` -# ๐Ÿš€3. Status Microservice +## ๐Ÿš€3. Status Microservice ```bash docker container logs -f dataprep-redis-server ``` -# ๐Ÿš€4. Consume Microservice +## ๐Ÿš€4. Consume Microservice -## 4.1 Consume Upload API +### 4.1 Consume Upload API Once document preparation microservice for Redis is started, user can use below command to invoke the microservice to convert the document to embedding and save to the database. @@ -236,7 +236,7 @@ except requests.exceptions.RequestException as e: print("An error occurred:", e) ``` -## 4.2 Consume get_file API +### 4.2 Consume get_file API To get uploaded file structures, use the following command: @@ -265,7 +265,7 @@ Then you will get the response JSON like this: ] ``` -## 4.3 Consume delete_file API +### 4.3 Consume delete_file API To delete uploaded file/link, use the following command. diff --git a/comps/embeddings/README.md b/comps/embeddings/README.md index edf164b48..407644ada 100644 --- a/comps/embeddings/README.md +++ b/comps/embeddings/README.md @@ -14,7 +14,7 @@ Key Features: Users are albe to configure and build embedding-related services according to their actual needs. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) Currently, we provide two ways to implement the embedding service: @@ -24,7 +24,7 @@ Currently, we provide two ways to implement the embedding service: For both of the implementations, you need to install requirements first. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash # run with langchain @@ -33,11 +33,11 @@ pip install -r langchain/requirements.txt pip install -r llama_index/requirements.txt ``` -## 1.2 Start Embedding Service +### 1.2 Start Embedding Service You can select one of following ways to start the embedding service: -### Start Embedding Service with TEI +#### Start Embedding Service with TEI First, you need to start a TEI service. @@ -69,7 +69,7 @@ export TEI_EMBEDDING_MODEL_NAME="BAAI/bge-large-en-v1.5" python embedding_tei.py ``` -### Start Embedding Service with Local Model +#### Start Embedding Service with Local Model ```bash # run with langchain @@ -79,9 +79,9 @@ cd llama_index python local_embedding.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Optional 2) +## ๐Ÿš€2. Start Microservice with Docker (Optional 2) -## 2.1 Start Embedding Service with TEI +### 2.1 Start Embedding Service with TEI First, you need to start a TEI service. @@ -108,23 +108,23 @@ export TEI_EMBEDDING_ENDPOINT="http://localhost:$yourport" export TEI_EMBEDDING_MODEL_NAME="BAAI/bge-large-en-v1.5" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image -### Build Langchain Docker (Option a) +#### Build Langchain Docker (Option a) ```bash cd ../../ docker build -t opea/embedding-tei:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/langchain/docker/Dockerfile . ``` -### Build LlamaIndex Docker (Option b) +#### Build LlamaIndex Docker (Option b) ```bash cd ../../ docker build -t opea/embedding-tei-llama-index:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/embeddings/llama_index/docker/Dockerfile . ``` -## 2.3 Run Docker with CLI +### 2.3 Run Docker with CLI ```bash # run with langchain docker @@ -133,16 +133,16 @@ docker run -d --name="embedding-tei-server" -p 6000:6000 --ipc=host -e http_prox docker run -d --name="embedding-tei-llama-index-server" -p 6000:6000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e TEI_EMBEDDING_MODEL_NAME=$TEI_EMBEDDING_MODEL_NAME opea/embedding-tei-llama-index:latest ``` -## 2.4 Run Docker with Docker Compose +### 2.4 Run Docker with Docker Compose ```bash cd docker docker compose -f docker_compose_embedding.yaml up -d ``` -# ๐Ÿš€3. Consume Embedding Service +## ๐Ÿš€3. Consume Embedding Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:6000/v1/health_check\ @@ -150,7 +150,7 @@ curl http://localhost:6000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume Embedding Service +### 3.2 Consume Embedding Service ```bash curl http://localhost:6000/v1/embeddings\ diff --git a/comps/embeddings/langchain-mosec/README.md b/comps/embeddings/langchain-mosec/README.md index 624fcf6a2..4fd265829 100644 --- a/comps/embeddings/langchain-mosec/README.md +++ b/comps/embeddings/langchain-mosec/README.md @@ -4,26 +4,26 @@ docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t opea/embedding-langchain-mosec-endpoint:latest -f comps/embeddings/langchain-mosec/mosec-docker/Dockerfile . ``` -# build embedding microservice docker image +## build embedding microservice docker image ``` docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t opea/embedding-langchain-mosec:latest -f comps/embeddings/langchain-mosec/docker/Dockerfile . ``` -# launch Mosec endpoint docker container +## launch Mosec endpoint docker container ``` docker run -d --name="embedding-langchain-mosec-endpoint" -p 6001:8000 opea/embedding-langchain-mosec-endpoint:latest ``` -# launch embedding microservice docker container +## launch embedding microservice docker container ``` export MOSEC_EMBEDDING_ENDPOINT=http://{mosec_embedding_host_ip}:6001 docker run -d --name="embedding-langchain-mosec-server" -e http_proxy=$http_proxy -e https_proxy=$https_proxy -p 6000:6000 --ipc=host -e MOSEC_EMBEDDING_ENDPOINT=$MOSEC_EMBEDDING_ENDPOINT opea/embedding-langchain-mosec:latest ``` -# run client test +## run client test ``` curl localhost:6000/v1/embeddings \ diff --git a/comps/guardrails/llama_guard/README.md b/comps/guardrails/llama_guard/README.md index 084711125..019aab5e3 100644 --- a/comps/guardrails/llama_guard/README.md +++ b/comps/guardrails/llama_guard/README.md @@ -20,17 +20,17 @@ Any content that is detected in the following categories is determined as unsafe - Regulated or Controlled Substances - Suicide & Self Harm -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the Guardrails microservice, you need to install python packages first. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start TGI Gaudi Service +### 1.2 Start TGI Gaudi Service ```bash export HF_TOKEN=${your_hf_api_token} @@ -43,7 +43,7 @@ docker pull ghcr.io/huggingface/tgi-gaudi:2.0.1 docker run -p 8088:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e HTTPS_PROXY=$https_proxy -e HTTP_PROXY=$https_proxy -e HF_TOKEN=$HF_TOKEN ghcr.io/huggingface/tgi-gaudi:2.0.1 --model-id $model_id --max-input-length 1024 --max-total-tokens 2048 ``` -## 1.3 Verify the TGI Gaudi Service +### 1.3 Verify the TGI Gaudi Service ```bash curl 127.0.0.1:8088/generate \ @@ -52,7 +52,7 @@ curl 127.0.0.1:8088/generate \ -H 'Content-Type: application/json' ``` -## 1.4 Start Guardrails Service +### 1.4 Start Guardrails Service Optional: If you have deployed a Guardrails model with TGI Gaudi Service other than default model (i.e., `meta-llama/Meta-Llama-Guard-2-8B`) [from section 1.2](## 1.2 Start TGI Gaudi Service), you will need to add the eviornment variable `SAFETY_GUARD_MODEL_ID` containing the model id. For example, the following informs the Guardrails Service the deployed model used LlamaGuard2: @@ -65,11 +65,11 @@ export SAFETY_GUARD_ENDPOINT="http://${your_ip}:8088" python langchain/guardrails_tgi.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) If you start an Guardrails microservice with docker, the `docker_compose_guardrails.yaml` file will automatically start a TGI gaudi service with docker. -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables In order to start TGI and LLM services, you need to setup the following environment variables first. @@ -79,29 +79,29 @@ export SAFETY_GUARD_ENDPOINT="http://${your_ip}:8088" export LLM_MODEL_ID=${your_hf_llm_model} ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ docker build -t opea/guardrails-tgi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/guardrails/llama_guard/docker/Dockerfile . ``` -## 2.3 Run Docker with CLI +### 2.3 Run Docker with CLI ```bash docker run -d --name="guardrails-tgi-server" -p 9090:9090 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e SAFETY_GUARD_ENDPOINT=$SAFETY_GUARD_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN opea/guardrails-tgi:latest ``` -## 2.4 Run Docker with Docker Compose +### 2.4 Run Docker with Docker Compose ```bash cd langchain/docker docker compose -f docker_compose_guardrails.yaml up -d ``` -# ๐Ÿš€3. Consume Guardrails Service +## ๐Ÿš€3. Consume Guardrails Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:9090/v1/health_check\ @@ -109,7 +109,7 @@ curl http://localhost:9090/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume Guardrails Service +### 3.2 Consume Guardrails Service ```bash curl http://localhost:9090/v1/guardrails\ diff --git a/comps/guardrails/pii_detection/README.md b/comps/guardrails/pii_detection/README.md index 3c1f1180e..152fa96db 100644 --- a/comps/guardrails/pii_detection/README.md +++ b/comps/guardrails/pii_detection/README.md @@ -19,7 +19,7 @@ The classifiler model is used together with an embedding model to make predictio Currently this strategy can detect both personal sensitive and business sensitive information such as financial figures and performance reviews. Please refer to the [model card](<(https://huggingface.co/Intel/business_safety_logistic_regression_classifier)>) to see the performance of our demo model on the Patronus EnterprisePII dataset. -# Input and output +## Input and output Users can send a list of files, a list of text strings, or a list of urls to the microservice, and the microservice will return a list of True or False for each piece of text following the original sequence. @@ -27,15 +27,15 @@ For a concrete example of what input should look like, please refer to [Consume The output will be a list of booleans, which can be parsed and used as conditions in a bigger application. -# ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ +## ๐Ÿš€1. Start Microservice with Python๏ผˆOption 1๏ผ‰ -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start PII Detection Microservice with Python Script +### 1.2 Start PII Detection Microservice with Python Script Start pii detection microservice with below command. @@ -43,24 +43,24 @@ Start pii detection microservice with below command. python pii_detection.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Prepare PII detection model +### 2.1 Prepare PII detection model export HUGGINGFACEHUB_API_TOKEN=${HP_TOKEN} -## 2.1.1 use LLM endpoint (will add later) +#### 2.1.1 use LLM endpoint (will add later) intro placeholder -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../../ # back to GenAIComps/ folder docker build -t opea/guardrails-pii-detection:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/guardrails/pii_detection/docker/Dockerfile . ``` -## 2.3 Run Docker with CLI +### 2.3 Run Docker with CLI ```bash docker run -d --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} opea/guardrails-pii-detection:latest @@ -72,13 +72,13 @@ docker run -d --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p docker run --rm --runtime=runc --name="guardrails-pii-detection-endpoint" -p 6357:6357 -v ./comps/guardrails/pii_detection/:/home/user/comps/guardrails/pii_detection/ --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} opea/guardrails-pii-detection:latest ``` -# ๐Ÿš€3. Get Status of Microservice +## ๐Ÿš€3. Get Status of Microservice ```bash docker container logs -f guardrails-pii-detection-endpoint ``` -# ๐Ÿš€4. Consume Microservice +## ๐Ÿš€4. Consume Microservice Once microservice starts, user can use below script to invoke the microservice for pii detection. diff --git a/comps/knowledgegraphs/README.md b/comps/knowledgegraphs/README.md index 248e46eba..db8140b9c 100755 --- a/comps/knowledgegraphs/README.md +++ b/comps/knowledgegraphs/README.md @@ -16,9 +16,9 @@ A prerequisite for using this microservice is that users must have a knowledge g Overall, this microservice provides efficient support for applications related with graph dataset, especially for answering multi-part questions, or any other conditions including comples relationship between entities. -# ๐Ÿš€1. Start Microservice with Docker +## ๐Ÿš€1. Start Microservice with Docker -## 1.1 Setup Environment Variables +### 1.1 Setup Environment Variables ```bash export NEO4J_ENDPOINT="neo4j://${your_ip}:7687" @@ -30,7 +30,7 @@ export LLM_MODEL="meta-llama/Llama-2-7b-hf" export AGENT_LLM="HuggingFaceH4/zephyr-7b-beta" ``` -## 1.2 Start Neo4j Service +### 1.2 Start Neo4j Service ```bash docker pull neo4j @@ -43,7 +43,7 @@ docker run --rm \ neo4j ``` -## 1.3 Start LLM Service for "rag"/"query" mode +### 1.3 Start LLM Service for "rag"/"query" mode You can start any LLM microserve, here we take TGI as an example. @@ -70,7 +70,7 @@ curl $LLM_ENDPOINT/generate \ -H 'Content-Type: application/json' ``` -## 1.4 Start Microservice +### 1.4 Start Microservice ```bash cd ../.. @@ -93,9 +93,9 @@ docker run --rm \ opea/knowledge_graphs:latest ``` -# ๐Ÿš€2. Consume Knowledge Graph Service +## ๐Ÿš€2. Consume Knowledge Graph Service -## 2.1 Cypher mode +### 2.1 Cypher mode ```bash curl http://${your_ip}:8060/v1/graphs \ @@ -107,7 +107,7 @@ curl http://${your_ip}:8060/v1/graphs \ Example output: ![Cypher Output](doc/output_cypher.png) -## 2.2 Rag mode +### 2.2 Rag mode ```bash curl http://${your_ip}:8060/v1/graphs \ @@ -119,7 +119,7 @@ curl http://${your_ip}:8060/v1/graphs \ Example output: ![Cypher Output](doc/output_rag.png) -## 2.3 Query mode +### 2.3 Query mode First example: diff --git a/comps/llms/README.md b/comps/llms/README.md index 9c3867f03..d6ea6dbb6 100644 --- a/comps/llms/README.md +++ b/comps/llms/README.md @@ -6,19 +6,19 @@ A prerequisite for using this microservice is that users must have a LLM text ge Overall, this microservice offers a streamlined way to integrate large language model inference into applications, requiring minimal setup from the user beyond initiating a TGI/vLLM/Ray service and configuring the necessary environment variables. This allows for the seamless processing of queries and documents to generate intelligent, context-aware responses. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the LLM microservice, you need to install python packages first. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start LLM Service +### 1.2 Start LLM Service -### 1.2.1 Start TGI Service +#### 1.2.1 Start TGI Service ```bash export HF_TOKEN=${your_hf_api_token} @@ -28,14 +28,14 @@ export LANGCHAIN_PROJECT="opea/gen-ai-comps:llms" docker run -p 8008:80 -v ./data:/data --name tgi_service --shm-size 1g ghcr.io/huggingface/text-generation-inference:1.4 --model-id ${your_hf_llm_model} ``` -### 1.2.2 Start vLLM Service +#### 1.2.2 Start vLLM Service ```bash export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} docker run -it --name vllm_service -p 8008:80 -e HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -v ./data:/data opea/vllm:cpu /bin/bash -c "cd / && export VLLM_CPU_KVCACHE_SPACE=40 && python3 -m vllm.entrypoints.openai.api_server --model ${your_hf_llm_model} --port 80" ``` -## 1.2.3 Start Ray Service +### 1.2.3 Start Ray Service ```bash export HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} @@ -43,9 +43,9 @@ export TRUST_REMOTE_CODE=True docker run -it --runtime=habana --name ray_serve_service -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -p 8008:80 -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e TRUST_REMOTE_CODE=$TRUST_REMOTE_CODE opea/llm-ray:latest /bin/bash -c "ray start --head && python api_server_openai.py --port_number 80 --model_id_or_path ${your_hf_llm_model} --chat_processor ${your_hf_chatprocessor}" ``` -## 1.3 Verify the LLM Service +### 1.3 Verify the LLM Service -### 1.3.1 Verify the TGI Service +#### 1.3.1 Verify the TGI Service ```bash curl http://${your_ip}:8008/generate \ @@ -54,7 +54,7 @@ curl http://${your_ip}:8008/generate \ -H 'Content-Type: application/json' ``` -### 1.3.2 Verify the vLLM Service +#### 1.3.2 Verify the vLLM Service ```bash curl http://${your_ip}:8008/v1/completions \ @@ -67,7 +67,7 @@ curl http://${your_ip}:8008/v1/completions \ }' ``` -### 1.3.3 Verify the Ray Service +#### 1.3.3 Verify the Ray Service ```bash curl http://${your_ip}:8008/v1/chat/completions \ @@ -83,34 +83,34 @@ curl http://${your_ip}:8008/v1/chat/completions \ }' ``` -## 1.4 Start LLM Service with Python Script +### 1.4 Start LLM Service with Python Script -### 1.4.1 Start the TGI Service +#### 1.4.1 Start the TGI Service ```bash export TGI_LLM_ENDPOINT="http://${your_ip}:8008" python text-generation/tgi/llm.py ``` -### 1.4.2 Start the vLLM Service +#### 1.4.2 Start the vLLM Service ```bash export vLLM_LLM_ENDPOINT="http://${your_ip}:8008" python text-generation/vllm/llm.py ``` -### 1.4.3 Start the Ray Service +#### 1.4.3 Start the Ray Service ```bash export RAY_Serve_ENDPOINT="http://${your_ip}:8008" python text-generation/ray_serve/llm.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) If you start an LLM microservice with docker, the `docker_compose_llm.yaml` file will automatically start a TGI/vLLM service with docker. -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables In order to start TGI and LLM services, you need to setup the following environment variables first. @@ -144,16 +144,16 @@ export LANGCHAIN_PROJECT="opea/llms" export CHAT_PROCESSOR="ChatModelLlama" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image -### 2.2.1 TGI +#### 2.2.1 TGI ```bash cd ../../ docker build -t opea/llm-tgi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/tgi/Dockerfile . ``` -### 2.2.2 vLLM +#### 2.2.2 vLLM Build vllm docker. @@ -168,7 +168,7 @@ cd ../../../../ docker build -t opea/llm-vllm:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/vllm/docker/Dockerfile.microservice . ``` -### 2.2.3 Ray Serve +#### 2.2.3 Ray Serve Build Ray Serve docker. @@ -190,15 +190,15 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) -### 2.3.1 TGI +#### 2.3.1 TGI ```bash docker run -d --name="llm-tgi-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HF_TOKEN=$HF_TOKEN opea/llm-tgi:latest ``` -### 2.3.2 vLLM +#### 2.3.2 vLLM Start vllm endpoint. @@ -212,7 +212,7 @@ Start vllm microservice. docker run --name="llm-vllm-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=${no_proxy} -e vLLM_LLM_ENDPOINT=$vLLM_LLM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e LLM_MODEL_ID=$LLM_MODEL_ID opea/llm-vllm:latest ``` -### 2.3.3 Ray Serve +#### 2.3.3 Ray Serve Start Ray Serve endpoint. @@ -226,32 +226,32 @@ Start Ray Serve microservice. docker run -d --name="llm-ray-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e RAY_Serve_ENDPOINT=$RAY_Serve_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HUGGINGFACEHUB_API_TOKEN -e LLM_MODEL=$LLM_MODEL opea/llm-ray:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) -### 2.4.1 TGI +#### 2.4.1 TGI ```bash cd text-generation/tgi docker compose -f docker_compose_llm.yaml up -d ``` -### 2.4.2 vLLM +#### 2.4.2 vLLM ```bash cd text-generation/vllm docker compose -f docker_compose_llm.yaml up -d ``` -### 2.4.3 Ray Serve +#### 2.4.3 Ray Serve ```bash cd text-genetation/ray_serve docker compose -f docker_compose_llm.yaml up -d ``` -# ๐Ÿš€3. Consume LLM Service +## ๐Ÿš€3. Consume LLM Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:9000/v1/health_check\ @@ -259,7 +259,7 @@ curl http://${your_ip}:9000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume LLM Service +### 3.2 Consume LLM Service You can set the following model parameters according to your actual needs, such as `max_new_tokens`, `streaming`. @@ -279,7 +279,7 @@ curl http://${your_ip}:9000/v1/chat/completions \ -H 'Content-Type: application/json' ``` -## 4. Validated Model +### 4. Validated Model | Model | TGI-Gaudi | vLLM-CPU | vLLM-Gaudi | Ray | | ------------------------- | --------- | -------- | ---------- | --- | diff --git a/comps/llms/faq-generation/tgi/README.md b/comps/llms/faq-generation/tgi/README.md index 45f1ad1bd..9673ee7fe 100644 --- a/comps/llms/faq-generation/tgi/README.md +++ b/comps/llms/faq-generation/tgi/README.md @@ -2,11 +2,11 @@ This microservice interacts with the TGI LLM server to generate FAQs from Input Text.[Text Generation Inference](https://github.com/huggingface/text-generation-inference) (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and more. -# ๐Ÿš€1. Start Microservice with Docker +## ๐Ÿš€1. Start Microservice with Docker If you start an LLM microservice with docker, the `docker_compose_llm.yaml` file will automatically start a TGI service with docker. -## 1.1 Setup Environment Variables +### 1.1 Setup Environment Variables In order to start TGI and LLM services, you need to setup the following environment variables first. @@ -18,7 +18,7 @@ export LANGCHAIN_TRACING_V2=true export LANGCHAIN_API_KEY=${your_langchain_api_key} ``` -## 1.2 Build Docker Image +### 1.2 Build Docker Image ```bash cd ../../../../ @@ -32,7 +32,7 @@ To start a docker container, you have two options: You can choose one as needed. -## 1.3 Run Docker with CLI (Option A) +### 1.3 Run Docker with CLI (Option A) ```bash docker run -d -p 8008:80 -v ./data:/data --name tgi_service --shm-size 1g ghcr.io/huggingface/text-generation-inference:1.4 --model-id ${LLM_MODEL_ID} @@ -42,16 +42,16 @@ docker run -d -p 8008:80 -v ./data:/data --name tgi_service --shm-size 1g ghcr.i docker run -d --name="llm-faqgen-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HUGGINGFACEHUB_API_TOKEN=$HF_TOKEN opea/llm-faqgen-tgi:latest ``` -## 1.4 Run Docker with Docker Compose (Option B) +### 1.4 Run Docker with Docker Compose (Option B) ```bash cd text-generation/tgi docker compose -f docker_compose_llm.yaml up -d ``` -# ๐Ÿš€3. Consume LLM Service +## ๐Ÿš€3. Consume LLM Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:9000/v1/health_check\ @@ -59,7 +59,7 @@ curl http://${your_ip}:9000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume FAQGen LLM Service +### 3.2 Consume FAQGen LLM Service ```bash curl http://${your_ip}:9000/v1/faqgen \ diff --git a/comps/llms/summarization/tgi/README.md b/comps/llms/summarization/tgi/README.md index 9e5858b4b..c8cc9c44a 100644 --- a/comps/llms/summarization/tgi/README.md +++ b/comps/llms/summarization/tgi/README.md @@ -3,24 +3,24 @@ In this microservice, we utilize LangChain to implement summarization strategies and facilitate LLM inference using Text Generation Inference on Intel Xeon and Gaudi2 processors. [Text Generation Inference](https://github.com/huggingface/text-generation-inference) (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and more. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the LLM microservice, you need to install python packages first. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start LLM Service +### 1.2 Start LLM Service ```bash export HF_TOKEN=${your_hf_api_token} docker run -p 8008:80 -v ./data:/data --name llm-docsum-tgi --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id ${your_hf_llm_model} ``` -## 1.3 Verify the TGI Service +### 1.3 Verify the TGI Service ```bash curl http://${your_ip}:8008/generate \ @@ -29,18 +29,18 @@ curl http://${your_ip}:8008/generate \ -H 'Content-Type: application/json' ``` -## 1.4 Start LLM Service with Python Script +### 1.4 Start LLM Service with Python Script ```bash export TGI_LLM_ENDPOINT="http://${your_ip}:8008" python llm.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) If you start an LLM microservice with docker, the `docker_compose_llm.yaml` file will automatically start a TGI/vLLM service with docker. -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables In order to start TGI and LLM services, you need to setup the following environment variables first. @@ -50,7 +50,7 @@ export TGI_LLM_ENDPOINT="http://${your_ip}:8008" export LLM_MODEL_ID=${your_hf_llm_model} ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ @@ -64,21 +64,21 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="llm-docsum-tgi-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HF_TOKEN=$HF_TOKEN opea/llm-docsum-tgi:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash docker compose -f docker_compose_llm.yaml up -d ``` -# ๐Ÿš€3. Consume LLM Service +## ๐Ÿš€3. Consume LLM Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:9000/v1/health_check\ @@ -86,7 +86,7 @@ curl http://${your_ip}:9000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume LLM Service +### 3.2 Consume LLM Service ```bash curl http://${your_ip}:9000/v1/chat/docsum \ diff --git a/comps/llms/text-generation/ollama/README.md b/comps/llms/text-generation/ollama/README.md index fc7de914e..5a86e8c61 100644 --- a/comps/llms/text-generation/ollama/README.md +++ b/comps/llms/text-generation/ollama/README.md @@ -2,9 +2,9 @@ [Ollama](https://github.com/ollama/ollama) allows you to run open-source large language models, such as Llama 3, locally. Ollama bundles model weights, configuration, and data into a single package, defined by a Modelfile. Ollama is a lightweight, extensible framework for building and running language models on the local machine. It provides a simple API for creating, running, and managing models, as well as a library of pre-built models that can be easily used in a variety of applications. It's the best choice to deploy large language models on AIPC locally. -# Get Started +## Get Started -## Setup +### Setup Follow [these instructions](https://github.com/ollama/ollama) to set up and run a local Ollama instance. @@ -35,15 +35,15 @@ Special settings are necessary to pull models behind the proxy. sudo systemctl restart ollama ``` -## Usage +### Usage Here are a few ways to interact with pulled local models: -### In the terminal +#### In the terminal All of your local models are automatically served on localhost:11434. Run ollama run to start interacting via the command line directly. -### API access +#### API access Send an application/json request to the API endpoint of Ollama to interact. @@ -54,20 +54,20 @@ curl http://localhost:11434/api/generate -d '{ }' ``` -# Build Docker Image +## Build Docker Image ```bash cd GenAIComps/ docker build --no-cache -t opea/llm-ollama:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/ollama/Dockerfile . ``` -# Run the Ollama Microservice +## Run the Ollama Microservice ```bash docker run --network host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/llm-ollama:latest ``` -# Consume the Ollama Microservice +## Consume the Ollama Microservice ```bash curl http://127.0.0.1:9000/v1/chat/completions -X POST -d '{"model": "llama3", "query":"What is Deep Learning?","max_new_tokens":32,"top_k":10,"top_p":0.95,"typical_p":0.95,"temperature":0.01,"repetition_penalty":1.03,"streaming":true}' -H 'Content-Type: application/json' diff --git a/comps/llms/text-generation/tgi/README.md b/comps/llms/text-generation/tgi/README.md index 57f476720..cca4d1fa4 100644 --- a/comps/llms/text-generation/tgi/README.md +++ b/comps/llms/text-generation/tgi/README.md @@ -2,17 +2,17 @@ [Text Generation Inference](https://github.com/huggingface/text-generation-inference) (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and more. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the LLM microservice, you need to install python packages first. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start LLM Service +### 1.2 Start LLM Service ```bash export HF_TOKEN=${your_hf_api_token} @@ -22,7 +22,7 @@ export LANGCHAIN_PROJECT="opea/gen-ai-comps:llms" docker run -p 8008:80 -v ./data:/data --name tgi_service --shm-size 1g ghcr.io/huggingface/text-generation-inference:2.1.0 --model-id ${your_hf_llm_model} ``` -## 1.3 Verify the TGI Service +### 1.3 Verify the TGI Service ```bash curl http://${your_ip}:8008/generate \ @@ -31,18 +31,18 @@ curl http://${your_ip}:8008/generate \ -H 'Content-Type: application/json' ``` -## 1.4 Start LLM Service with Python Script +### 1.4 Start LLM Service with Python Script ```bash export TGI_LLM_ENDPOINT="http://${your_ip}:8008" python text-generation/tgi/llm.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) If you start an LLM microservice with docker, the `docker_compose_llm.yaml` file will automatically start a TGI/vLLM service with docker. -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables In order to start TGI and LLM services, you need to setup the following environment variables first. @@ -55,7 +55,7 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/llms" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ @@ -69,22 +69,22 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="llm-tgi-server" -p 9000:9000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TGI_LLM_ENDPOINT=$TGI_LLM_ENDPOINT -e HF_TOKEN=$HF_TOKEN opea/llm-tgi:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash cd text-generation/tgi docker compose -f docker_compose_llm.yaml up -d ``` -# ๐Ÿš€3. Consume LLM Service +## ๐Ÿš€3. Consume LLM Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:9000/v1/health_check\ @@ -92,7 +92,7 @@ curl http://${your_ip}:9000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume LLM Service +### 3.2 Consume LLM Service You can set the following model parameters according to your actual needs, such as `max_new_tokens`, `streaming`. @@ -118,7 +118,7 @@ curl http://${your_ip}:9000/v1/chat/completions \ -H 'Content-Type: application/json' ``` -## 4. Validated Model +### 4. Validated Model | Model | TGI | | ------------------------- | --- | diff --git a/comps/llms/text-generation/vllm-xft/README.md b/comps/llms/text-generation/vllm-xft/README.md index 68931d4ca..4b39709a8 100644 --- a/comps/llms/text-generation/vllm-xft/README.md +++ b/comps/llms/text-generation/vllm-xft/README.md @@ -1,24 +1,26 @@ +# vLLM-xFT + vLLM-xFT is a fork of vLLM to integrate the xfastertransformer backend, maintaining compatibility with most of the official vLLM's features. For usage of vllm-xFT, please refer to [xFasterTransformer/vllm-xft](https://github.com/intel/xFasterTransformer/blob/main/serving/vllm-xft.md) -# ๐Ÿš€ Start Microservice with Docker +## ๐Ÿš€ Start Microservice with Docker -## 1 Build Docker Image +### 1 Build Docker Image ```bash cd ../../../ docker build -t opea/llm-vllm-xft:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/vllm-xft/docker/Dockerfile . ``` -## 2 Run Docker with CLI +### 2 Run Docker with CLI ```bash docker run -it -p 9000:9000 -v /home/sdp/Qwen2-7B-Instruct/:/Qwen2-7B-Instruct/ -e vLLM_LLM_ENDPOINT="http://localhost:18688" -e HF_DATASET_DIR="/Qwen2-7B-Instruct/" -e OUTPUT_DIR="./output" -e TOKEN_PATH="/Qwen2-7B-Instruct/" -e https_proxy=$https_proxy -e http_proxy=$http_proxy -e no_proxy=$no_proxy --ipc=host opea/llm-vllm-xft:latest ``` -# ๐Ÿš€3. Consume LLM Service +## ๐Ÿš€3. Consume LLM Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:9000/v1/health_check\ @@ -26,7 +28,7 @@ curl http://${your_ip}:9000/v1/health_check\ -H 'Content-Type: application/json' ``` -## 3.2 Consume LLM Service +### 3.2 Consume LLM Service You can set the following model parameters according to your actual needs, such as `max_new_tokens`, `streaming`. diff --git a/comps/lvms/README.md b/comps/lvms/README.md index 8f8237180..12648e99b 100644 --- a/comps/lvms/README.md +++ b/comps/lvms/README.md @@ -2,15 +2,15 @@ Visual Question and Answering is one of the multimodal tasks empowered by LVMs (Large Visual Models). This microservice supports visual Q&A by using LLaVA as the base large visual model. It accepts two inputs: a prompt and an image. It outputs the answer to the prompt about the image. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start LLaVA Service/Test +### 1.2 Start LLaVA Service/Test - Xeon CPU @@ -37,7 +37,7 @@ nohup python llava_server.py & python check_llava_server.py ``` -## 1.3 Start Image To Text Service/Test +### 1.3 Start Image To Text Service/Test ```bash cd .. @@ -47,11 +47,11 @@ python lvm.py python check_lvm.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Build Images +### 2.1 Build Images -### 2.1.1 LLaVA Server Image +#### 2.1.1 LLaVA Server Image - Xeon CPU @@ -67,16 +67,16 @@ cd ../.. docker build -t opea/llava:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/lvms/llava/Dockerfile_hpu . ``` -### 2.1.2 LVM Service Image +#### 2.1.2 LVM Service Image ```bash cd ../.. docker build -t opea/lvm:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/lvms/Dockerfile . ``` -## 2.2 Start LLaVA and LVM Service +### 2.2 Start LLaVA and LVM Service -### 2.2.1 Start LLaVA server +#### 2.2.1 Start LLaVA server - Xeon @@ -90,7 +90,7 @@ docker run -p 8399:8399 -e http_proxy=$http_proxy --ipc=host -e https_proxy=$htt docker run -p 8399:8399 --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/llava:latest ``` -### 2.2.2 Start LVM service +#### 2.2.2 Start LVM service ```bash ip_address=$(hostname -I | awk '{print $1}') @@ -98,7 +98,7 @@ ip_address=$(hostname -I | awk '{print $1}') docker run -p 9399:9399 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e LVM_ENDPOINT=http://$ip_address:8399 opea/lvm:latest ``` -### 2.2.3 Test +#### 2.2.3 Test ```bash # Use curl/python diff --git a/comps/prompt_registry/mongo/README.md b/comps/prompt_registry/mongo/README.md index 0cbfd6f99..86baaaf27 100644 --- a/comps/prompt_registry/mongo/README.md +++ b/comps/prompt_registry/mongo/README.md @@ -21,16 +21,16 @@ Start document preparation microservice for Milvus with below command. python prompt.py ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ~/GenAIComps docker build -t opea/promptregistry-mongo-server:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/prompt_registry/mongo/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI 1. Run mongoDB image @@ -44,7 +44,7 @@ docker run -d -p 27017:27017 --name=mongo mongo:latest docker run -d --name="promptregistry-mongo-server" -p 6012:6012 -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e MONGO_HOST=${MONGO_HOST} -e MONGO_PORT=${MONGO_PORT} -e DB_NAME=${DB_NAME} -e COLLECTION_NAME=${COLLECTION_NAME} opea/promptregistry-mongo-server:latest ``` -## Invoke Microservice +### Invoke Microservice Once prompt_registry service is up and running, users can access the database by using API endpoint below. Each API serves different purpose and return appropriate response. diff --git a/comps/reranks/README.md b/comps/reranks/README.md index ecec38272..9b5dc9042 100644 --- a/comps/reranks/README.md +++ b/comps/reranks/README.md @@ -2,17 +2,17 @@ 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. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the Reranking microservice, you must first install the required python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start TEI Service +### 1.2 Start TEI Service ```bash export HF_TOKEN=${your_hf_api_token} @@ -25,7 +25,7 @@ volume=$PWD/data docker run -d -p 6060:80 -v $volume:/data -e http_proxy=$http_proxy -e https_proxy=$https_proxy --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 --model-id $RERANK_MODEL_ID --revision $revision --hf-api-token $HF_TOKEN ``` -## 1.3 Verify the TEI Service +### 1.3 Verify the TEI Service ```bash curl 127.0.0.1:6060/rerank \ @@ -34,18 +34,18 @@ curl 127.0.0.1:6060/rerank \ -H 'Content-Type: application/json' ``` -## 1.4 Start Reranking Service with Python Script +### 1.4 Start Reranking Service with Python Script ```bash export TEI_RERANKING_ENDPOINT="http://${your_ip}:6060" python reranking_tei_xeon.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) If you start an Reranking microservice with docker, the `docker_compose_reranking.yaml` file will automatically start a TEI service with docker. -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export HF_TOKEN=${your_hf_api_token} @@ -55,7 +55,7 @@ export LANGCHAIN_PROJECT="opea/reranks" export TEI_RERANKING_ENDPOINT="http://${your_ip}:8808" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ @@ -69,22 +69,22 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="reranking-tei-server" -p 8000:8000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TEI_RERANKING_ENDPOINT=$TEI_RERANKING_ENDPOINT -e HF_TOKEN=$HF_TOKEN -e LANGCHAIN_API_KEY=$LANGCHAIN_API_KEY opea/reranking-tei:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash cd langchain/docker docker compose -f docker_compose_reranking.yaml up -d ``` -# ๐Ÿš€3. Consume Reranking Service +## ๐Ÿš€3. Consume Reranking Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:8000/v1/health_check \ @@ -92,7 +92,7 @@ curl http://localhost:8000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Reranking Service +### 3.2 Consume Reranking Service ```bash curl http://localhost:8000/v1/reranking \ diff --git a/comps/reranks/fastrag/README.md b/comps/reranks/fastrag/README.md index fac481860..025799d05 100644 --- a/comps/reranks/fastrag/README.md +++ b/comps/reranks/fastrag/README.md @@ -2,17 +2,17 @@ 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. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the Reranking microservice, you must first install the required python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Install fastRAG +### 1.2 Install fastRAG ```bash git clone https://github.com/IntelLabs/fastRAG.git @@ -21,37 +21,37 @@ pip install . pip install .[intel] ``` -## 1.3 Start Reranking Service with Python Script +### 1.3 Start Reranking Service with Python Script ```bash export EMBED_MODEL="Intel/bge-small-en-v1.5-rag-int8-static" python local_reranking.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export EMBED_MODEL="Intel/bge-small-en-v1.5-rag-int8-static" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ docker build -t opea/reranking-fastrag:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/reranks/fastrag/docker/Dockerfile . ``` -## 2.3 Run Docker +### 2.3 Run Docker ```bash docker run -d --name="reranking-fastrag-server" -p 8000:8000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e EMBED_MODEL=$EMBED_MODEL opea/reranking-fastrag:latest ``` -# ๐Ÿš€3. Consume Reranking Service +## ๐Ÿš€3. Consume Reranking Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:8000/v1/health_check \ @@ -59,7 +59,7 @@ curl http://localhost:8000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Reranking Service +### 3.2 Consume Reranking Service ```bash curl http://localhost:8000/v1/reranking \ diff --git a/comps/reranks/langchain-mosec/README.md b/comps/reranks/langchain-mosec/README.md index 59592a4ba..cd7e36ce0 100644 --- a/comps/reranks/langchain-mosec/README.md +++ b/comps/reranks/langchain-mosec/README.md @@ -4,26 +4,26 @@ docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t opea/reranking-langchain-mosec-endpoint:latest -f comps/reranks/langchain-mosec/mosec-docker/Dockerfile . ``` -# build reranking microservice docker image +## build reranking microservice docker image ``` docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t opea/reranking-langchain-mosec:latest -f comps/reranks/langchain-mosec/docker/Dockerfile . ``` -# launch Mosec endpoint docker container +## launch Mosec endpoint docker container ``` docker run -d --name="reranking-langchain-mosec-endpoint" -p 6001:8000 opea/reranking-langchain-mosec-endpoint:latest ``` -# launch embedding microservice docker container +## launch embedding microservice docker container ``` export MOSEC_RERANKING_ENDPOINT=http://127.0.0.1:6001 docker run -d --name="reranking-langchain-mosec-server" -e http_proxy=$http_proxy -e https_proxy=$https_proxy -p 6000:8000 --ipc=host -e MOSEC_RERANKING_ENDPOINT=$MOSEC_RERANKING_ENDPOINT opea/reranking-langchain-mosec:latest ``` -# run client test +## run client test ``` curl http://localhost:6000/v1/reranking \ diff --git a/comps/retrievers/haystack/qdrant/README.md b/comps/retrievers/haystack/qdrant/README.md index 66da3c627..a7653e8ce 100644 --- a/comps/retrievers/haystack/qdrant/README.md +++ b/comps/retrievers/haystack/qdrant/README.md @@ -1,18 +1,18 @@ # Retriever Microservice with Qdrant -# 1. ๐Ÿš€Start Microservice with Python (Option 1) +## 1. ๐Ÿš€Start Microservice with Python (Option 1) -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start Qdrant Server +### 1.2 Start Qdrant Server Please refer to this [readme](../../../vectorstores/langchain/qdrant/README.md). -## 1.3 Setup Environment Variables +### 1.3 Setup Environment Variables ```bash export QDRANT_HOST=${your_qdrant_host_ip} @@ -21,16 +21,16 @@ export EMBED_DIMENSION=${your_embedding_dimension} export INDEX_NAME=${your_index_name} ``` -## 1.4 Start Retriever Service +### 1.4 Start Retriever Service ```bash export TEI_EMBEDDING_ENDPOINT="http://${your_ip}:6060" python haystack/qdrant/retriever_qdrant.py ``` -# 2. ๐Ÿš€Start Microservice with Docker (Option 2) +## 2. ๐Ÿš€Start Microservice with Docker (Option 2) -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export QDRANT_HOST=${your_qdrant_host_ip} @@ -38,22 +38,22 @@ export QDRANT_PORT=6333 export TEI_EMBEDDING_ENDPOINT="http://${your_ip}:6060" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ docker build -t opea/retriever-qdrant:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/haystack/qdrant/docker/Dockerfile . ``` -## 2.3 Run Docker with CLI +### 2.3 Run Docker with CLI ```bash docker run -d --name="retriever-qdrant-server" -p 7000:7000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT -e QDRANT_HOST=$QDRANT_HOST -e QDRANT_PORT=$QDRANT_PORT opea/retriever-qdrant:latest ``` -# ๐Ÿš€3. Consume Retriever Service +## ๐Ÿš€3. Consume Retriever Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:7000/v1/health_check \ @@ -61,7 +61,7 @@ curl http://${your_ip}:7000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Embedding Service +### 3.2 Consume Embedding Service To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. diff --git a/comps/retrievers/langchain/README.md b/comps/retrievers/langchain/README.md index 3de5cab21..300fbc099 100644 --- a/comps/retrievers/langchain/README.md +++ b/comps/retrievers/langchain/README.md @@ -6,14 +6,14 @@ The service primarily utilizes similarity measures in vector space to rapidly re 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. -# Retriever Microservice with Redis +## Retriever Microservice with Redis For details, please refer to this [readme](redis/README.md) -# Retriever Microservice with Milvus +## Retriever Microservice with Milvus For details, please refer to this [readme](milvus/README.md) -# Retriever Microservice with PGVector +## Retriever Microservice with PGVector For details, please refer to this [readme](pgvector/README.md) diff --git a/comps/retrievers/langchain/milvus/README.md b/comps/retrievers/langchain/milvus/README.md index d1bbc80da..6b9fe2045 100644 --- a/comps/retrievers/langchain/milvus/README.md +++ b/comps/retrievers/langchain/milvus/README.md @@ -1,18 +1,18 @@ # Retriever Microservice with Milvus -# ๐Ÿš€Start Microservice with Python +## ๐Ÿš€Start Microservice with Python -## Install Requirements +### Install Requirements ```bash pip install -r requirements.txt ``` -## Start Milvus Server +### Start Milvus Server Please refer to this [readme](../../../vectorstores/langchain/milvus/README.md). -## Setup Environment Variables +### Setup Environment Variables ```bash export no_proxy=${your_no_proxy} @@ -24,31 +24,31 @@ export COLLECTION_NAME=${your_collection_name} export MOSEC_EMBEDDING_ENDPOINT=${your_emdding_endpoint} ``` -## Start Retriever Service +### Start Retriever Service ```bash export MOSEC_EMBEDDING_ENDPOINT="http://${your_ip}:6060" python langchain/retriever_redis.py ``` -# ๐Ÿš€Start Microservice with Docker +## ๐Ÿš€Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../ docker build -t opea/retriever-milvus:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/langchain/milvus/docker/Dockerfile . ``` -## Run Docker with CLI +### Run Docker with CLI ```bash docker run -d --name="retriever-milvus-server" -p 7000:7000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e MOSEC_EMBEDDING_ENDPOINT=${your_emdding_endpoint} -e MILVUS=${your_milvus_host_ip} opea/retriever-milvus:latest ``` -# ๐Ÿš€3. Consume Retriever Service +## ๐Ÿš€3. Consume Retriever Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://${your_ip}:7000/v1/health_check \ @@ -56,7 +56,7 @@ curl http://${your_ip}:7000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Embedding Service +### 3.2 Consume Embedding Service To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. diff --git a/comps/retrievers/langchain/pgvector/README.md b/comps/retrievers/langchain/pgvector/README.md index a0febb7fb..4914e8cb4 100644 --- a/comps/retrievers/langchain/pgvector/README.md +++ b/comps/retrievers/langchain/pgvector/README.md @@ -6,17 +6,17 @@ The service primarily utilizes similarity measures in vector space to rapidly re 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. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the retriever microservice, you must first install the required python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start TEI Service +### 1.2 Start TEI Service ```bash export LANGCHAIN_TRACING_V2=true @@ -28,7 +28,7 @@ volume=$PWD/data docker run -d -p 6060:80 -v $volume:/data -e http_proxy=$http_proxy -e https_proxy=$https_proxy --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 --model-id $model --revision $revision ``` -## 1.3 Verify the TEI Service +### 1.3 Verify the TEI Service ```bash curl 127.0.0.1:6060/rerank \ @@ -37,7 +37,7 @@ curl 127.0.0.1:6060/rerank \ -H 'Content-Type: application/json' ``` -## 1.4 Setup VectorDB Service +### 1.4 Setup VectorDB Service You need to setup your own VectorDB service (PGvector in this example), and ingest your knowledge documents into the vector database. @@ -52,16 +52,16 @@ export POSTGRES_DB=vectordb docker run --name vectorstore-postgres -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -d -v ./init.sql:/docker-entrypoint-initdb.d/init.sql -p 5432:5432 pgvector/pgvector:0.7.0-pg16 ``` -## 1.5 Start Retriever Service +### 1.5 Start Retriever Service ```bash export TEI_EMBEDDING_ENDPOINT="http://${your_ip}:6060" python retriever_pgvector.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export RETRIEVE_MODEL_ID="BAAI/bge-base-en-v1.5" @@ -73,7 +73,7 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/retrievers" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd comps/retrievers/langchain/pgvector/docker @@ -87,22 +87,22 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="retriever-pgvector" -p 7000:7000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e PG_CONNECTION_STRING=$PG_CONNECTION_STRING -e INDEX_NAME=$INDEX_NAME -e TEI_ENDPOINT=$TEI_ENDPOINT opea/retriever-pgvector:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash cd comps/retrievers/langchain/pgvector/docker docker compose -f docker_compose_retriever.yaml up -d ``` -# ๐Ÿš€3. Consume Retriever Service +## ๐Ÿš€3. Consume Retriever Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:7000/v1/health_check \ @@ -110,7 +110,7 @@ curl http://localhost:7000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Embedding Service +### 3.2 Consume Embedding Service To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. diff --git a/comps/retrievers/langchain/redis/README.md b/comps/retrievers/langchain/redis/README.md index 5330e7870..17c37ed4c 100644 --- a/comps/retrievers/langchain/redis/README.md +++ b/comps/retrievers/langchain/redis/README.md @@ -6,17 +6,17 @@ The service primarily utilizes similarity measures in vector space to rapidly re 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. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the retriever microservice, you must first install the required python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Start TEI Service +### 1.2 Start TEI Service ```bash export LANGCHAIN_TRACING_V2=true @@ -28,7 +28,7 @@ volume=$PWD/data docker run -d -p 6060:80 -v $volume:/data -e http_proxy=$http_proxy -e https_proxy=$https_proxy --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 --model-id $model --revision $revision ``` -## 1.3 Verify the TEI Service +### 1.3 Verify the TEI Service ```bash curl 127.0.0.1:6060/rerank \ @@ -37,7 +37,7 @@ curl 127.0.0.1:6060/rerank \ -H 'Content-Type: application/json' ``` -## 1.4 Setup VectorDB Service +### 1.4 Setup VectorDB Service You need to setup your own VectorDB service (Redis in this example), and ingest your knowledge documents into the vector database. @@ -48,16 +48,16 @@ Remember to ingest data into it manually. docker run -d --name="redis-vector-db" -p 6379:6379 -p 8001:8001 redis/redis-stack:7.2.0-v9 ``` -## 1.5 Start Retriever Service +### 1.5 Start Retriever Service ```bash export TEI_EMBEDDING_ENDPOINT="http://${your_ip}:6060" python langchain/retriever_redis.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export RETRIEVE_MODEL_ID="BAAI/bge-base-en-v1.5" @@ -69,7 +69,7 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/retrievers" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ @@ -83,22 +83,22 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="retriever-redis-server" -p 7000:7000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT opea/retriever-redis:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash cd langchain/docker docker compose -f docker_compose_retriever.yaml up -d ``` -# ๐Ÿš€3. Consume Retriever Service +## ๐Ÿš€3. Consume Retriever Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:7000/v1/health_check \ @@ -106,7 +106,7 @@ curl http://localhost:7000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Embedding Service +### 3.2 Consume Embedding Service To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. diff --git a/comps/retrievers/llamaindex/README.md b/comps/retrievers/llamaindex/README.md index 3f6db8899..28203160c 100644 --- a/comps/retrievers/llamaindex/README.md +++ b/comps/retrievers/llamaindex/README.md @@ -6,17 +6,17 @@ The service primarily utilizes similarity measures in vector space to rapidly re 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. -# ๐Ÿš€1. Start Microservice with Python (Option 1) +## ๐Ÿš€1. Start Microservice with Python (Option 1) To start the retriever microservice, you must first install the required python packages. -## 1.1 Install Requirements +### 1.1 Install Requirements ```bash pip install -r requirements.txt ``` -## 1.2 Setup VectorDB Service +### 1.2 Setup VectorDB Service You need to setup your own VectorDB service (Redis in this example), and ingest your knowledge documents into the vector database. @@ -29,15 +29,15 @@ docker run -d --name="redis-vector-db" -p 6379:6379 -p 8001:8001 redis/redis-sta And then ingest data into the Redis VectorDB using the methods described in the dataprep microservice. -## 1.3 Start Retriever Service +### 1.3 Start Retriever Service ```bash python retriever_redis.py ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) -## 2.1 Setup Environment Variables +### 2.1 Setup Environment Variables ```bash export REDIS_URL="redis://${your_ip}:6379" @@ -47,7 +47,7 @@ export LANGCHAIN_API_KEY=${your_langchain_api_key} export LANGCHAIN_PROJECT="opea/retrievers" ``` -## 2.2 Build Docker Image +### 2.2 Build Docker Image ```bash cd ../../ @@ -61,22 +61,22 @@ To start a docker container, you have two options: You can choose one as needed. -## 2.3 Run Docker with CLI (Option A) +### 2.3 Run Docker with CLI (Option A) ```bash docker run -d --name="retriever-redis-server" -p 7000:7000 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e REDIS_URL=$REDIS_URL -e INDEX_NAME=$INDEX_NAME opea/retriever-redis:latest ``` -## 2.4 Run Docker with Docker Compose (Option B) +### 2.4 Run Docker with Docker Compose (Option B) ```bash cd llamaindex/docker docker compose -f docker_compose_retriever.yaml up -d ``` -# ๐Ÿš€3. Consume Retriever Service +## ๐Ÿš€3. Consume Retriever Service -## 3.1 Check Service Status +### 3.1 Check Service Status ```bash curl http://localhost:7000/v1/health_check \ @@ -84,7 +84,7 @@ curl http://localhost:7000/v1/health_check \ -H 'Content-Type: application/json' ``` -## 3.2 Consume Retriever Service +### 3.2 Consume Retriever Service To consume the Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. diff --git a/comps/tts/README.md b/comps/tts/README.md index 52ab6c92b..5045d5870 100644 --- a/comps/tts/README.md +++ b/comps/tts/README.md @@ -30,13 +30,13 @@ python tts.py curl http://localhost:9088/v1/audio/speech -XPOST -d '{"text": "Who are you?"}' -H 'Content-Type: application/json' ``` -# ๐Ÿš€2. Start Microservice with Docker (Option 2) +## ๐Ÿš€2. Start Microservice with Docker (Option 2) Alternatively, you can start the TTS microservice with Docker. -## 2.1 Build Images +### 2.1 Build Images -### 2.1.1 Whisper Server Image +#### 2.1.1 Whisper Server Image - Xeon CPU @@ -52,15 +52,15 @@ cd ../.. docker build -t opea/speecht5-gaudi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/tts/speecht5/Dockerfile_hpu . ``` -### 2.1.2 TTS Service Image +#### 2.1.2 TTS Service Image ```bash docker build -t opea/tts:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/tts/Dockerfile . ``` -## 2.2 Start SpeechT5 and TTS Service +### 2.2 Start SpeechT5 and TTS Service -### 2.2.1 Start SpeechT5 Server +#### 2.2.1 Start SpeechT5 Server - Xeon @@ -74,7 +74,7 @@ docker run -p 7055:7055 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$htt docker run -p 7055:7055 --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy opea/speecht5-gaudi:latest ``` -### 2.2.2 Start TTS service +#### 2.2.2 Start TTS service ```bash ip_address=$(hostname -I | awk '{print $1}') @@ -82,7 +82,7 @@ ip_address=$(hostname -I | awk '{print $1}') docker run -p 9088:9088 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e TTS_ENDPOINT=http://$ip_address:7055 opea/tts:latest ``` -### 2.2.3 Test +#### 2.2.3 Test ```bash # curl diff --git a/comps/vectorstores/README.md b/comps/vectorstores/README.md index 6dd35ee0b..bdccf5bc0 100644 --- a/comps/vectorstores/README.md +++ b/comps/vectorstores/README.md @@ -2,18 +2,18 @@ The Vectorstores Microservice provides convenient way to start various vector database servers. -# Vectorstores Microservice with Redis +## Vectorstores Microservice with Redis For details, please refer to this [readme](langchain/redis/README.md) -# Vectorstores Microservice with Qdrant +## Vectorstores Microservice with Qdrant For details, please refer to this [readme](langchain/qdrant/README.md) -# Vectorstores Microservice with PGVector +## Vectorstores Microservice with PGVector For details, please refer to this [readme](langchain/pgvector/README.md) -# Vectorstores Microservice with Pinecone +## Vectorstores Microservice with Pinecone For details, please refer to this [readme](langchain/pinecone/README.md) diff --git a/comps/vectorstores/langchain/chroma/README.md b/comps/vectorstores/langchain/chroma/README.md index c64b094f6..155593010 100644 --- a/comps/vectorstores/langchain/chroma/README.md +++ b/comps/vectorstores/langchain/chroma/README.md @@ -2,9 +2,9 @@ Chroma is a AI-native open-source vector database focused on developer productivity and happiness. Chroma is licensed under Apache 2.0. Chroma runs in various modes, we can deploy it as a server running your local machine or in the cloud. -# Getting Started +## Getting Started -## Start Chroma Server +### Start Chroma Server To start the Chroma server on your local machine, follow these steps: @@ -14,7 +14,7 @@ cd chroma docker compose up -d ``` -## Start Log Output +### Start Log Output Upon starting the server, you should see log outputs similar to the following: diff --git a/comps/web_retrievers/langchain/chroma/README.md b/comps/web_retrievers/langchain/chroma/README.md index 47a308837..563a04965 100644 --- a/comps/web_retrievers/langchain/chroma/README.md +++ b/comps/web_retrievers/langchain/chroma/README.md @@ -2,16 +2,16 @@ The Web Retriever Microservice is designed to efficiently search web pages relevant to the prompt, save them into the VectorDB, and retrieve the matched documents with the highest similarity. The retrieved documents will be used as context in the prompt to LLMs. Different from the normal RAG process, a web retriever can leverage advanced search engines for more diverse demands, such as real-time news, verifiable sources, and diverse sources. -# Start Microservice with Docker +## Start Microservice with Docker -## Build Docker Image +### Build Docker Image ```bash cd ../../ docker build -t opea/web-retriever-chroma:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/web_retrievers/langchain/chroma/docker/Dockerfile . ``` -## Start TEI Service +### Start TEI Service ```bash model=BAAI/bge-base-en-v1.5 @@ -20,7 +20,7 @@ volume=$PWD/data docker run -d -p 6060:80 -v $volume:/data -e http_proxy=$http_proxy -e https_proxy=$https_proxy --pull always ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 --model-id $model --revision $revision ``` -## Start Web Retriever Service +### Start Web Retriever Service ```bash # set TEI endpoint @@ -35,7 +35,7 @@ export GOOGLE_CSE_ID=xxx docker run -d --name="web-retriever-chroma-server" -p 7078:7077 --ipc=host -e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e TEI_EMBEDDING_ENDPOINT=$TEI_EMBEDDING_ENDPOINT opea/web-retriever-chroma:latest ``` -## Consume Web Retriever Service +### Consume Web Retriever Service To consume the Web Retriever Microservice, you can generate a mock embedding vector of length 768 with Python. From cc8cd702ae8c9d25f8f962308ad120c408e17a7c Mon Sep 17 00:00:00 2001 From: lvliang-intel Date: Sun, 18 Aug 2024 17:11:13 +0800 Subject: [PATCH 10/11] Remove unnecessary langsmith dependency (#369) Signed-off-by: lvliang-intel --- README.md | 2 - comps/agent/langchain/requirements.txt | 1 - comps/dataprep/milvus/prepare_doc_milvus.py | 4 - comps/dataprep/milvus/requirements.txt | 1 - .../langchain/prepare_doc_pgvector.py | 4 - .../pgvector/langchain/requirements.txt | 1 - .../dataprep/pinecone/prepare_doc_pinecone.py | 4 - comps/dataprep/pinecone/requirements.txt | 1 - .../langchain_ray/prepare_doc_redis_on_ray.py | 3 - .../redis/langchain_ray/requirements.txt | 1 - .../redis/llama_index/prepare_doc_redis.py | 4 - .../redis/llama_index/requirements.txt | 1 - .../langchain-mosec/embedding_mosec.py | 2 - comps/embeddings/langchain/embedding_tei.py | 2 - comps/embeddings/langchain/requirements.txt | 1 - comps/embeddings/llama_index/embedding_tei.py | 2 - .../embeddings/llama_index/local_embedding.py | 2 - comps/embeddings/llama_index/requirements.txt | 1 - .../guardrails/llama_guard/guardrails_tgi.py | 2 - comps/guardrails/llama_guard/requirements.txt | 1 - .../guardrails/pii_detection/pii_detection.py | 1 - .../guardrails/pii_detection/requirements.txt | 1 - .../langchain/knowledge_graph.py | 1 - comps/knowledgegraphs/requirements.txt | 1 - comps/llms/faq-generation/tgi/llm.py | 3 - .../llms/faq-generation/tgi/requirements.txt | 1 - comps/llms/summarization/tgi/llm.py | 3 - comps/llms/summarization/tgi/requirements.txt | 1 - comps/llms/text-generation/ollama/llm.py | 2 - .../text-generation/ollama/requirements.txt | 1 - comps/llms/text-generation/ray_serve/llm.py | 82 +++++++++++++++++++ .../ray_serve/requirements.txt | 13 +++ comps/llms/text-generation/tgi/llm.py | 2 - .../llms/text-generation/tgi/requirements.txt | 1 - comps/llms/text-generation/vllm-ray/llm.py | 2 - .../text-generation/vllm-ray/requirements.txt | 1 - comps/llms/text-generation/vllm-xft/llm.py | 2 - .../text-generation/vllm-xft/requirements.txt | 1 - comps/llms/text-generation/vllm/llm.py | 2 - comps/ragas/tgi/llm.py | 2 - comps/ragas/tgi/requirements.txt | 1 - comps/reranks/fastrag/local_reranking.py | 2 - comps/reranks/fastrag/requirements.txt | 1 - .../langchain-mosec/reranking_mosec_xeon.py | 2 - comps/reranks/requirements.txt | 1 - comps/reranks/tei/local_reranking.py | 2 - comps/reranks/tei/reranking_tei.py | 2 - .../haystack/qdrant/requirements.txt | 1 - .../haystack/qdrant/retriever_qdrant.py | 2 - .../langchain/milvus/retriever_milvus.py | 4 +- .../langchain/pgvector/requirements.txt | 1 - .../langchain/pgvector/retriever_pgvector.py | 2 - .../langchain/pinecone/requirements.txt | 1 - .../langchain/pinecone/retriever_pinecone.py | 2 - .../langchain/redis/requirements.txt | 1 - .../langchain/redis/retriever_redis.py | 2 - comps/retrievers/llamaindex/requirements.txt | 1 - .../retrievers/llamaindex/retriever_redis.py | 2 - 58 files changed, 96 insertions(+), 97 deletions(-) create mode 100644 comps/llms/text-generation/ray_serve/llm.py create mode 100644 comps/llms/text-generation/ray_serve/requirements.txt diff --git a/README.md b/README.md index 8c3af2373..e1b48a08c 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,6 @@ A `Microservices` can be created by using the decorator `register_microservice`. ```python from langchain_community.embeddings import HuggingFaceHubEmbeddings -from langsmith import traceable from comps import register_microservice, EmbedDoc, ServiceType, TextDoc @@ -187,7 +186,6 @@ from comps import register_microservice, EmbedDoc, ServiceType, TextDoc input_datatype=TextDoc, output_datatype=EmbedDoc, ) -@traceable(run_type="embedding") def embedding(input: TextDoc) -> EmbedDoc: embed_vector = embeddings.embed_query(input.text) res = EmbedDoc(text=input.text, embedding=embed_vector) diff --git a/comps/agent/langchain/requirements.txt b/comps/agent/langchain/requirements.txt index 16859ac2c..fa1c4423b 100644 --- a/comps/agent/langchain/requirements.txt +++ b/comps/agent/langchain/requirements.txt @@ -11,7 +11,6 @@ langchain-openai langchain_community langchainhub langgraph -langsmith numpy # used by cloud native diff --git a/comps/dataprep/milvus/prepare_doc_milvus.py b/comps/dataprep/milvus/prepare_doc_milvus.py index 143010c06..a293963c4 100644 --- a/comps/dataprep/milvus/prepare_doc_milvus.py +++ b/comps/dataprep/milvus/prepare_doc_milvus.py @@ -22,7 +22,6 @@ from langchain_core.documents import Document from langchain_milvus.vectorstores import Milvus from langchain_text_splitters import HTMLHeaderTextSplitter -from langsmith import traceable from pyspark import SparkConf, SparkContext from comps import DocPath, opea_microservices, register_microservice @@ -167,7 +166,6 @@ async def ingest_link_to_milvus(link_list: List[str]): @register_microservice(name="opea_service@prepare_doc_milvus", endpoint="/v1/dataprep", host="0.0.0.0", port=6010) -@traceable(run_type="tool") async def ingest_documents( files: Optional[Union[UploadFile, List[UploadFile]]] = File(None), link_list: Optional[str] = Form(None), @@ -239,7 +237,6 @@ def process_files_wrapper(files): @register_microservice( name="opea_service@prepare_doc_milvus_file", endpoint="/v1/dataprep/get_file", host="0.0.0.0", port=6011 ) -@traceable(run_type="tool") async def rag_get_file_structure(): print("[ dataprep - get file ] start to get file structure") @@ -270,7 +267,6 @@ def delete_by_partition_field(my_milvus, partition_field): @register_microservice( name="opea_service@prepare_doc_milvus_del", endpoint="/v1/dataprep/delete_file", host="0.0.0.0", port=6012 ) -@traceable(run_type="tool") async def delete_single_file(file_path: str = Body(..., embed=True)): """Delete file according to `file_path`. diff --git a/comps/dataprep/milvus/requirements.txt b/comps/dataprep/milvus/requirements.txt index cf088a1c0..48b8be1d9 100644 --- a/comps/dataprep/milvus/requirements.txt +++ b/comps/dataprep/milvus/requirements.txt @@ -9,7 +9,6 @@ langchain langchain-community langchain-text-splitters langchain_milvus -langsmith markdown numpy openai diff --git a/comps/dataprep/pgvector/langchain/prepare_doc_pgvector.py b/comps/dataprep/pgvector/langchain/prepare_doc_pgvector.py index efb394991..f46e466ba 100644 --- a/comps/dataprep/pgvector/langchain/prepare_doc_pgvector.py +++ b/comps/dataprep/pgvector/langchain/prepare_doc_pgvector.py @@ -13,7 +13,6 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings from langchain_community.vectorstores import PGVector -from langsmith import traceable from comps import DocPath, opea_microservices, register_microservice from comps.dataprep.utils import ( @@ -174,7 +173,6 @@ async def ingest_link_to_pgvector(link_list: List[str]): host="0.0.0.0", port=6007, ) -@traceable(run_type="tool") async def ingest_documents( files: Optional[Union[UploadFile, List[UploadFile]]] = File(None), link_list: Optional[str] = Form(None) ): @@ -214,7 +212,6 @@ async def ingest_documents( @register_microservice( name="opea_service@prepare_doc_pgvector", endpoint="/v1/dataprep/get_file", host="0.0.0.0", port=6007 ) -@traceable(run_type="tool") async def rag_get_file_structure(): print("[ dataprep - get file ] start to get file structure") @@ -229,7 +226,6 @@ async def rag_get_file_structure(): @register_microservice( name="opea_service@prepare_doc_pgvector", endpoint="/v1/dataprep/delete_file", host="0.0.0.0", port=6007 ) -@traceable(run_type="tool") async def delete_single_file(file_path: str = Body(..., embed=True)): """Delete file according to `file_path`. diff --git a/comps/dataprep/pgvector/langchain/requirements.txt b/comps/dataprep/pgvector/langchain/requirements.txt index 84fd48e52..b5b4f168b 100644 --- a/comps/dataprep/pgvector/langchain/requirements.txt +++ b/comps/dataprep/pgvector/langchain/requirements.txt @@ -8,7 +8,6 @@ huggingface_hub langchain langchain-community langchain-text-splitters -langsmith markdown numpy opentelemetry-api diff --git a/comps/dataprep/pinecone/prepare_doc_pinecone.py b/comps/dataprep/pinecone/prepare_doc_pinecone.py index ec0e200a2..cbee8cd94 100644 --- a/comps/dataprep/pinecone/prepare_doc_pinecone.py +++ b/comps/dataprep/pinecone/prepare_doc_pinecone.py @@ -14,7 +14,6 @@ from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceEmbeddings, HuggingFaceHubEmbeddings from langchain_pinecone import PineconeVectorStore from langchain_text_splitters import HTMLHeaderTextSplitter -from langsmith import traceable from pinecone import Pinecone, ServerlessSpec from comps import DocPath, opea_microservices, opea_telemetry, register_microservice @@ -172,7 +171,6 @@ async def ingest_link_to_pinecone(link_list: List[str]): @register_microservice(name="opea_service@prepare_doc_pinecone", endpoint="/v1/dataprep", host="0.0.0.0", port=6007) -@traceable(run_type="tool") async def ingest_documents( files: Optional[Union[UploadFile, List[UploadFile]]] = File(None), link_list: Optional[str] = Form(None), @@ -223,7 +221,6 @@ async def ingest_documents( @register_microservice( name="opea_service@prepare_doc_pinecone_file", endpoint="/v1/dataprep/get_file", host="0.0.0.0", port=6008 ) -@traceable(run_type="tool") async def rag_get_file_structure(): print("[ dataprep - get file ] start to get file structure") @@ -238,7 +235,6 @@ async def rag_get_file_structure(): @register_microservice( name="opea_service@prepare_doc_pinecone_del", endpoint="/v1/dataprep/delete_file", host="0.0.0.0", port=6009 ) -@traceable(run_type="tool") async def delete_all(file_path: str = Body(..., embed=True)): """Delete file according to `file_path`. diff --git a/comps/dataprep/pinecone/requirements.txt b/comps/dataprep/pinecone/requirements.txt index a2d5c4298..06ab12ecd 100644 --- a/comps/dataprep/pinecone/requirements.txt +++ b/comps/dataprep/pinecone/requirements.txt @@ -10,7 +10,6 @@ langchain-community langchain-openai langchain-pinecone langchain-text-splitters -langsmith markdown numpy opentelemetry-api diff --git a/comps/dataprep/redis/langchain_ray/prepare_doc_redis_on_ray.py b/comps/dataprep/redis/langchain_ray/prepare_doc_redis_on_ray.py index c55165061..07ad81da8 100644 --- a/comps/dataprep/redis/langchain_ray/prepare_doc_redis_on_ray.py +++ b/comps/dataprep/redis/langchain_ray/prepare_doc_redis_on_ray.py @@ -26,7 +26,6 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings from langchain_community.vectorstores import Redis -from langsmith import traceable cur_path = pathlib.Path(__file__).parent.resolve() comps_path = os.path.join(cur_path, "../../../../") @@ -322,7 +321,6 @@ async def ingest_documents(files: List[UploadFile] = File(None), link_list: str @register_microservice( name="opea_service@prepare_doc_redis_file", endpoint="/v1/dataprep/get_file", host="0.0.0.0", port=6008 ) -@traceable(run_type="tool") async def rag_get_file_structure(): print("[ get_file_structure] ") @@ -337,7 +335,6 @@ async def rag_get_file_structure(): @register_microservice( name="opea_service@prepare_doc_redis_del", endpoint="/v1/dataprep/delete_file", host="0.0.0.0", port=6009 ) -@traceable(run_type="tool") async def delete_single_file(file_path: str = Body(..., embed=True)): """Delete file according to `file_path`. diff --git a/comps/dataprep/redis/langchain_ray/requirements.txt b/comps/dataprep/redis/langchain_ray/requirements.txt index 50d57b20e..a77ba5c4d 100644 --- a/comps/dataprep/redis/langchain_ray/requirements.txt +++ b/comps/dataprep/redis/langchain_ray/requirements.txt @@ -7,7 +7,6 @@ fastapi huggingface_hub langchain langchain-community -langsmith numpy opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/dataprep/redis/llama_index/prepare_doc_redis.py b/comps/dataprep/redis/llama_index/prepare_doc_redis.py index da176555b..ae4d00461 100644 --- a/comps/dataprep/redis/llama_index/prepare_doc_redis.py +++ b/comps/dataprep/redis/llama_index/prepare_doc_redis.py @@ -8,7 +8,6 @@ from config import EMBED_MODEL, INDEX_NAME, REDIS_URL from fastapi import Body, File, HTTPException, UploadFile -from langsmith import traceable from llama_index.core import SimpleDirectoryReader, StorageContext, VectorStoreIndex from llama_index.core.settings import Settings from llama_index.embeddings.huggingface import HuggingFaceEmbedding @@ -55,7 +54,6 @@ async def ingest_data_to_redis(doc_path: DocPath): @register_microservice(name="opea_service@prepare_doc_redis", endpoint="/v1/dataprep", host="0.0.0.0", port=6007) -@traceable(run_type="tool") # llama index only support upload files now async def ingest_documents(files: Optional[Union[UploadFile, List[UploadFile]]] = File(None)): print(f"files:{files}") @@ -81,7 +79,6 @@ async def ingest_documents(files: Optional[Union[UploadFile, List[UploadFile]]] @register_microservice( name="opea_service@prepare_doc_redis_file", endpoint="/v1/dataprep/get_file", host="0.0.0.0", port=6008 ) -@traceable(run_type="tool") async def rag_get_file_structure(): print("[ get_file_structure] ") @@ -96,7 +93,6 @@ async def rag_get_file_structure(): @register_microservice( name="opea_service@prepare_doc_redis_del", endpoint="/v1/dataprep/delete_file", host="0.0.0.0", port=6009 ) -@traceable(run_type="tool") async def delete_single_file(file_path: str = Body(..., embed=True)): """Delete file according to `file_path`. diff --git a/comps/dataprep/redis/llama_index/requirements.txt b/comps/dataprep/redis/llama_index/requirements.txt index ad75869c1..2f808e534 100644 --- a/comps/dataprep/redis/llama_index/requirements.txt +++ b/comps/dataprep/redis/llama_index/requirements.txt @@ -1,7 +1,6 @@ docarray[full] fastapi huggingface_hub -langsmith llama-index llama-index-embeddings-huggingface==0.2.0 llama-index-readers-file diff --git a/comps/embeddings/langchain-mosec/embedding_mosec.py b/comps/embeddings/langchain-mosec/embedding_mosec.py index f13c23eca..702b1937c 100644 --- a/comps/embeddings/langchain-mosec/embedding_mosec.py +++ b/comps/embeddings/langchain-mosec/embedding_mosec.py @@ -6,7 +6,6 @@ from typing import List, Optional from langchain_community.embeddings import OpenAIEmbeddings -from langsmith import traceable from comps import ( EmbedDoc, @@ -53,7 +52,6 @@ def empty_embedding() -> List[float]: input_datatype=TextDoc, output_datatype=EmbedDoc, ) -@traceable(run_type="embedding") @register_statistics(names=["opea_service@embedding_mosec"]) def embedding(input: TextDoc) -> EmbedDoc: start = time.time() diff --git a/comps/embeddings/langchain/embedding_tei.py b/comps/embeddings/langchain/embedding_tei.py index 6a5fbc614..a318ff0bf 100644 --- a/comps/embeddings/langchain/embedding_tei.py +++ b/comps/embeddings/langchain/embedding_tei.py @@ -6,7 +6,6 @@ from typing import Union from langchain_huggingface import HuggingFaceEndpointEmbeddings -from langsmith import traceable from comps import ( EmbedDoc, @@ -32,7 +31,6 @@ host="0.0.0.0", port=6000, ) -@traceable(run_type="embedding") @register_statistics(names=["opea_service@embedding_tei_langchain"]) def embedding( input: Union[TextDoc, EmbeddingRequest, ChatCompletionRequest] diff --git a/comps/embeddings/langchain/requirements.txt b/comps/embeddings/langchain/requirements.txt index 8f0dd3ad4..1bfe6f44c 100644 --- a/comps/embeddings/langchain/requirements.txt +++ b/comps/embeddings/langchain/requirements.txt @@ -3,7 +3,6 @@ fastapi huggingface_hub langchain langchain_huggingface -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/embeddings/llama_index/embedding_tei.py b/comps/embeddings/llama_index/embedding_tei.py index 4f3920d32..9042a61a7 100644 --- a/comps/embeddings/llama_index/embedding_tei.py +++ b/comps/embeddings/llama_index/embedding_tei.py @@ -3,7 +3,6 @@ import os -from langsmith import traceable from llama_index.embeddings.text_embeddings_inference import TextEmbeddingsInference from comps import EmbedDoc, ServiceType, TextDoc, opea_microservices, register_microservice @@ -18,7 +17,6 @@ input_datatype=TextDoc, output_datatype=EmbedDoc, ) -@traceable(run_type="embedding") def embedding(input: TextDoc) -> EmbedDoc: embed_vector = embeddings._get_query_embedding(input.text) res = EmbedDoc(text=input.text, embedding=embed_vector) diff --git a/comps/embeddings/llama_index/local_embedding.py b/comps/embeddings/llama_index/local_embedding.py index f6a69afaf..53cc30e15 100644 --- a/comps/embeddings/llama_index/local_embedding.py +++ b/comps/embeddings/llama_index/local_embedding.py @@ -1,7 +1,6 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -from langsmith import traceable from llama_index.embeddings.huggingface_api import HuggingFaceInferenceAPIEmbedding from comps import EmbedDoc, ServiceType, TextDoc, opea_microservices, register_microservice @@ -16,7 +15,6 @@ input_datatype=TextDoc, output_datatype=EmbedDoc, ) -@traceable(run_type="embedding") def embedding(input: TextDoc) -> EmbedDoc: embed_vector = embeddings.get_text_embedding(input.text) res = EmbedDoc(text=input.text, embedding=embed_vector) diff --git a/comps/embeddings/llama_index/requirements.txt b/comps/embeddings/llama_index/requirements.txt index 908c38b06..4f1457e4a 100644 --- a/comps/embeddings/llama_index/requirements.txt +++ b/comps/embeddings/llama_index/requirements.txt @@ -1,7 +1,6 @@ docarray[full] fastapi huggingface_hub -langsmith llama-index-embeddings-huggingface-api llama-index-embeddings-text-embeddings-inference opentelemetry-api diff --git a/comps/guardrails/llama_guard/guardrails_tgi.py b/comps/guardrails/llama_guard/guardrails_tgi.py index b415876ed..93b046e97 100644 --- a/comps/guardrails/llama_guard/guardrails_tgi.py +++ b/comps/guardrails/llama_guard/guardrails_tgi.py @@ -7,7 +7,6 @@ from langchain_community.utilities.requests import JsonRequestsWrapper from langchain_huggingface import ChatHuggingFace from langchain_huggingface.llms import HuggingFaceEndpoint -from langsmith import traceable from comps import GeneratedDoc, ServiceType, TextDoc, opea_microservices, register_microservice @@ -63,7 +62,6 @@ def get_tgi_service_model_id(endpoint_url, default=DEFAULT_MODEL): input_datatype=Union[GeneratedDoc, TextDoc], output_datatype=TextDoc, ) -@traceable(run_type="llm") def safety_guard(input: Union[GeneratedDoc, TextDoc]) -> TextDoc: if isinstance(input, GeneratedDoc): messages = [{"role": "user", "content": input.prompt}, {"role": "assistant", "content": input.text}] diff --git a/comps/guardrails/llama_guard/requirements.txt b/comps/guardrails/llama_guard/requirements.txt index 5eda60170..9f35ee74d 100644 --- a/comps/guardrails/llama_guard/requirements.txt +++ b/comps/guardrails/llama_guard/requirements.txt @@ -4,7 +4,6 @@ fastapi huggingface-hub<=0.24.0 langchain-community langchain-huggingface -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/guardrails/pii_detection/pii_detection.py b/comps/guardrails/pii_detection/pii_detection.py index feecf3baf..1ae0dddae 100644 --- a/comps/guardrails/pii_detection/pii_detection.py +++ b/comps/guardrails/pii_detection/pii_detection.py @@ -8,7 +8,6 @@ from pathlib import Path from fastapi import File, Form, HTTPException, UploadFile -from langsmith import traceable cur_path = pathlib.Path(__file__).parent.resolve() comps_path = os.path.join(cur_path, "../../../") diff --git a/comps/guardrails/pii_detection/requirements.txt b/comps/guardrails/pii_detection/requirements.txt index e9bb7ba66..bc95de0fd 100644 --- a/comps/guardrails/pii_detection/requirements.txt +++ b/comps/guardrails/pii_detection/requirements.txt @@ -8,7 +8,6 @@ gibberish-detector huggingface_hub langchain langchain-community -langsmith numpy opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/knowledgegraphs/langchain/knowledge_graph.py b/comps/knowledgegraphs/langchain/knowledge_graph.py index 9ed2c5b65..01d1a5a5a 100755 --- a/comps/knowledgegraphs/langchain/knowledge_graph.py +++ b/comps/knowledgegraphs/langchain/knowledge_graph.py @@ -22,7 +22,6 @@ from langchain_community.graphs import Neo4jGraph from langchain_community.llms import HuggingFaceEndpoint from langchain_community.vectorstores.neo4j_vector import Neo4jVector -from langsmith import traceable from comps import GeneratedDoc, GraphDoc, ServiceType, opea_microservices, register_microservice diff --git a/comps/knowledgegraphs/requirements.txt b/comps/knowledgegraphs/requirements.txt index ecb5228af..39b351530 100755 --- a/comps/knowledgegraphs/requirements.txt +++ b/comps/knowledgegraphs/requirements.txt @@ -8,7 +8,6 @@ langchain langchain_community==0.2.5 langchain_openai langchainhub -langsmith neo4j numpy opentelemetry-api diff --git a/comps/llms/faq-generation/tgi/llm.py b/comps/llms/faq-generation/tgi/llm.py index af23a74af..beaa5700b 100644 --- a/comps/llms/faq-generation/tgi/llm.py +++ b/comps/llms/faq-generation/tgi/llm.py @@ -9,12 +9,10 @@ from langchain.prompts import PromptTemplate from langchain.text_splitter import CharacterTextSplitter from langchain_community.llms import HuggingFaceEndpoint -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice -@traceable(run_type="tool") def post_process_text(text: str): if text == " ": return "data: @#$\n\n" @@ -33,7 +31,6 @@ def post_process_text(text: str): host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): llm_endpoint = os.getenv("TGI_LLM_ENDPOINT", "http://localhost:8080") llm = HuggingFaceEndpoint( diff --git a/comps/llms/faq-generation/tgi/requirements.txt b/comps/llms/faq-generation/tgi/requirements.txt index 623a8f667..fbe54af95 100644 --- a/comps/llms/faq-generation/tgi/requirements.txt +++ b/comps/llms/faq-generation/tgi/requirements.txt @@ -3,7 +3,6 @@ fastapi huggingface_hub langchain==0.1.16 langserve -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/llms/summarization/tgi/llm.py b/comps/llms/summarization/tgi/llm.py index a9db6248d..43a583a96 100644 --- a/comps/llms/summarization/tgi/llm.py +++ b/comps/llms/summarization/tgi/llm.py @@ -8,12 +8,10 @@ from langchain.docstore.document import Document from langchain.text_splitter import CharacterTextSplitter from langchain_huggingface import HuggingFaceEndpoint -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice -@traceable(run_type="tool") def post_process_text(text: str): if text == " ": return "data: @#$\n\n" @@ -32,7 +30,6 @@ def post_process_text(text: str): host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): llm_endpoint = os.getenv("TGI_LLM_ENDPOINT", "http://localhost:8080") llm = HuggingFaceEndpoint( diff --git a/comps/llms/summarization/tgi/requirements.txt b/comps/llms/summarization/tgi/requirements.txt index c6c151f6e..e074ba8c8 100644 --- a/comps/llms/summarization/tgi/requirements.txt +++ b/comps/llms/summarization/tgi/requirements.txt @@ -6,7 +6,6 @@ langchain-huggingface langchain-openai langchain_community langchainhub -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/llms/text-generation/ollama/llm.py b/comps/llms/text-generation/ollama/llm.py index aadb2e2fa..1f6d330c8 100644 --- a/comps/llms/text-generation/ollama/llm.py +++ b/comps/llms/text-generation/ollama/llm.py @@ -5,7 +5,6 @@ from fastapi.responses import StreamingResponse from langchain_community.llms import Ollama -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice @@ -17,7 +16,6 @@ host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): ollama = Ollama( base_url=ollama_endpoint, diff --git a/comps/llms/text-generation/ollama/requirements.txt b/comps/llms/text-generation/ollama/requirements.txt index e224aaaa5..78b323c73 100644 --- a/comps/llms/text-generation/ollama/requirements.txt +++ b/comps/llms/text-generation/ollama/requirements.txt @@ -2,7 +2,6 @@ docarray[full] fastapi huggingface_hub langchain==0.1.16 -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/llms/text-generation/ray_serve/llm.py b/comps/llms/text-generation/ray_serve/llm.py new file mode 100644 index 000000000..c86025625 --- /dev/null +++ b/comps/llms/text-generation/ray_serve/llm.py @@ -0,0 +1,82 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +from fastapi.responses import StreamingResponse +from langchain_openai import ChatOpenAI + +from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice + + +def post_process_text(text: str): + if text == " ": + return "data: @#$\n\n" + if text == "\n": + return "data:
\n\n" + if text.isspace(): + return None + new_text = text.replace(" ", "@#$") + return f"data: {new_text}\n\n" + + +@register_microservice( + name="opea_service@llm_ray", + service_type=ServiceType.LLM, + endpoint="/v1/chat/completions", + host="0.0.0.0", + port=9000, +) +def llm_generate(input: LLMParamsDoc): + llm_endpoint = os.getenv("RAY_Serve_ENDPOINT", "http://localhost:8080") + llm_model = os.getenv("LLM_MODEL", "Llama-2-7b-chat-hf") + if "/" in llm_model: + llm_model = llm_model.split("/")[-1] + llm = ChatOpenAI( + openai_api_base=llm_endpoint + "/v1", + model_name=llm_model, + openai_api_key=os.getenv("OPENAI_API_KEY", "not_needed"), + max_tokens=input.max_new_tokens, + temperature=input.temperature, + streaming=input.streaming, + request_timeout=600, + ) + + if input.streaming: + + async def stream_generator(): + chat_response = "" + async for text in llm.astream(input.query): + text = text.content + chat_response += text + processed_text = post_process_text(text) + if text and processed_text: + if "" in text: + res = text.split("")[0] + if res != "": + yield res + break + yield processed_text + print(f"[llm - chat_stream] stream response: {chat_response}") + yield "data: [DONE]\n\n" + + return StreamingResponse(stream_generator(), media_type="text/event-stream") + else: + response = llm.invoke(input.query) + response = response.content + return GeneratedDoc(text=response, prompt=input.query) + + +if __name__ == "__main__": + opea_microservices["opea_service@llm_ray"].start() diff --git a/comps/llms/text-generation/ray_serve/requirements.txt b/comps/llms/text-generation/ray_serve/requirements.txt new file mode 100644 index 000000000..d97ce32e2 --- /dev/null +++ b/comps/llms/text-generation/ray_serve/requirements.txt @@ -0,0 +1,13 @@ +docarray[full] +fastapi +huggingface_hub +langchain==0.1.16 +langchain_openai +openai +opentelemetry-api +opentelemetry-exporter-otlp +opentelemetry-sdk +prometheus-fastapi-instrumentator +ray[serve]>=2.10 +shortuuid +transformers diff --git a/comps/llms/text-generation/tgi/llm.py b/comps/llms/text-generation/tgi/llm.py index c202aede7..6597d5b57 100644 --- a/comps/llms/text-generation/tgi/llm.py +++ b/comps/llms/text-generation/tgi/llm.py @@ -8,7 +8,6 @@ from fastapi.responses import StreamingResponse from huggingface_hub import AsyncInferenceClient from langchain_core.prompts import PromptTemplate -from langsmith import traceable from openai import OpenAI from template import ChatTemplate @@ -37,7 +36,6 @@ host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") @register_statistics(names=["opea_service@llm_tgi"]) async def llm_generate(input: Union[LLMParamsDoc, ChatCompletionRequest]): diff --git a/comps/llms/text-generation/tgi/requirements.txt b/comps/llms/text-generation/tgi/requirements.txt index 9670813d6..6b6f11ee4 100644 --- a/comps/llms/text-generation/tgi/requirements.txt +++ b/comps/llms/text-generation/tgi/requirements.txt @@ -3,7 +3,6 @@ docarray[full] fastapi httpx huggingface_hub -langsmith openai==1.35.13 opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/llms/text-generation/vllm-ray/llm.py b/comps/llms/text-generation/vllm-ray/llm.py index 6d8abd028..d3de026e0 100644 --- a/comps/llms/text-generation/vllm-ray/llm.py +++ b/comps/llms/text-generation/vllm-ray/llm.py @@ -16,7 +16,6 @@ from fastapi.responses import StreamingResponse from langchain_openai import ChatOpenAI -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice @@ -28,7 +27,6 @@ host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): llm_endpoint = os.getenv("vLLM_RAY_ENDPOINT", "http://localhost:8006") llm_model = os.getenv("LLM_MODEL", "meta-llama/Llama-2-7b-chat-hf") diff --git a/comps/llms/text-generation/vllm-ray/requirements.txt b/comps/llms/text-generation/vllm-ray/requirements.txt index 083a2910b..1f9020583 100644 --- a/comps/llms/text-generation/vllm-ray/requirements.txt +++ b/comps/llms/text-generation/vllm-ray/requirements.txt @@ -4,7 +4,6 @@ huggingface_hub langchain==0.1.16 langchain_openai langserve -langsmith openai opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/llms/text-generation/vllm-xft/llm.py b/comps/llms/text-generation/vllm-xft/llm.py index 02446baa6..2c479d90b 100644 --- a/comps/llms/text-generation/vllm-xft/llm.py +++ b/comps/llms/text-generation/vllm-xft/llm.py @@ -5,7 +5,6 @@ from fastapi.responses import StreamingResponse from langchain_community.llms import VLLMOpenAI -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, register_microservice @@ -17,7 +16,6 @@ host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): llm_endpoint = os.getenv("vLLM_LLM_ENDPOINT", "http://localhost:18688") llm = VLLMOpenAI( diff --git a/comps/llms/text-generation/vllm-xft/requirements.txt b/comps/llms/text-generation/vllm-xft/requirements.txt index bc9f457c4..a4accaed2 100644 --- a/comps/llms/text-generation/vllm-xft/requirements.txt +++ b/comps/llms/text-generation/vllm-xft/requirements.txt @@ -1,7 +1,6 @@ docarray[full] fastapi langchain==0.1.16 -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/llms/text-generation/vllm/llm.py b/comps/llms/text-generation/vllm/llm.py index ea8691f1a..61bebbe27 100644 --- a/comps/llms/text-generation/vllm/llm.py +++ b/comps/llms/text-generation/vllm/llm.py @@ -5,7 +5,6 @@ from fastapi.responses import StreamingResponse from langchain_community.llms import VLLMOpenAI -from langsmith import traceable from comps import GeneratedDoc, LLMParamsDoc, ServiceType, opea_microservices, opea_telemetry, register_microservice @@ -29,7 +28,6 @@ def post_process_text(text: str): host="0.0.0.0", port=9000, ) -@traceable(run_type="llm") def llm_generate(input: LLMParamsDoc): llm_endpoint = os.getenv("vLLM_ENDPOINT", "http://localhost:8008") model_name = os.getenv("LLM_MODEL", "meta-llama/Meta-Llama-3-8B-Instruct") diff --git a/comps/ragas/tgi/llm.py b/comps/ragas/tgi/llm.py index 895705703..03c214d30 100644 --- a/comps/ragas/tgi/llm.py +++ b/comps/ragas/tgi/llm.py @@ -11,7 +11,6 @@ HuggingFaceInstructEmbeddings, ) from langchain_community.llms import HuggingFaceEndpoint -from langsmith import traceable from ragas import evaluate from ragas.metrics import answer_relevancy, context_precision, context_recall, faithfulness @@ -30,7 +29,6 @@ input_datatype=RAGASParams, output_datatype=RAGASScores, ) -@traceable(run_type="llm") def llm_generate(input: RAGASParams): llm_endpoint = os.getenv("TGI_LLM_ENDPOINT", "http://localhost:8080") diff --git a/comps/ragas/tgi/requirements.txt b/comps/ragas/tgi/requirements.txt index 2c8fad29f..7839ef15d 100644 --- a/comps/ragas/tgi/requirements.txt +++ b/comps/ragas/tgi/requirements.txt @@ -3,7 +3,6 @@ docarray[full] fastapi huggingface_hub langchain==0.1.16 -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/reranks/fastrag/local_reranking.py b/comps/reranks/fastrag/local_reranking.py index f11ebc1f9..4548ef9a7 100644 --- a/comps/reranks/fastrag/local_reranking.py +++ b/comps/reranks/fastrag/local_reranking.py @@ -4,7 +4,6 @@ from config import RANKER_MODEL from fastrag.rankers import IPEXBiEncoderSimilarityRanker from haystack import Document -from langsmith import traceable from comps.cores.mega.micro_service import ServiceType, opea_microservices, register_microservice from comps.cores.proto.docarray import RerankedDoc, SearchedDoc, TextDoc @@ -19,7 +18,6 @@ input_datatype=SearchedDoc, output_datatype=RerankedDoc, ) -@traceable(run_type="llm") def reranking(input: SearchedDoc) -> RerankedDoc: documents = [] for i, d in enumerate(input.retrieved_docs): diff --git a/comps/reranks/fastrag/requirements.txt b/comps/reranks/fastrag/requirements.txt index c4ded91c8..e8166a77a 100644 --- a/comps/reranks/fastrag/requirements.txt +++ b/comps/reranks/fastrag/requirements.txt @@ -2,7 +2,6 @@ docarray[full] fastapi haystack-ai langchain -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/reranks/langchain-mosec/reranking_mosec_xeon.py b/comps/reranks/langchain-mosec/reranking_mosec_xeon.py index 4640433af..da3d7854a 100644 --- a/comps/reranks/langchain-mosec/reranking_mosec_xeon.py +++ b/comps/reranks/langchain-mosec/reranking_mosec_xeon.py @@ -22,7 +22,6 @@ import requests from langchain_core.prompts import ChatPromptTemplate -from langsmith import traceable from comps import ( LLMParamsDoc, @@ -44,7 +43,6 @@ input_datatype=SearchedDoc, output_datatype=LLMParamsDoc, ) -@traceable(run_type="llm") @register_statistics(names=["opea_service@reranking_mosec_xeon"]) def reranking(input: SearchedDoc) -> LLMParamsDoc: print("reranking input: ", input) diff --git a/comps/reranks/requirements.txt b/comps/reranks/requirements.txt index 67503038f..7260862a3 100644 --- a/comps/reranks/requirements.txt +++ b/comps/reranks/requirements.txt @@ -2,7 +2,6 @@ aiohttp docarray[full] fastapi httpx -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/reranks/tei/local_reranking.py b/comps/reranks/tei/local_reranking.py index d0fa8a79c..f02a95823 100644 --- a/comps/reranks/tei/local_reranking.py +++ b/comps/reranks/tei/local_reranking.py @@ -1,7 +1,6 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -from langsmith import traceable from sentence_transformers import CrossEncoder from comps import RerankedDoc, SearchedDoc, ServiceType, TextDoc, opea_microservices, register_microservice @@ -16,7 +15,6 @@ input_datatype=SearchedDoc, output_datatype=RerankedDoc, ) -@traceable(run_type="llm") def reranking(input: SearchedDoc) -> RerankedDoc: query_and_docs = [(input.initial_query, doc.text) for doc in input.retrieved_docs] scores = reranker_model.predict(query_and_docs) diff --git a/comps/reranks/tei/reranking_tei.py b/comps/reranks/tei/reranking_tei.py index 2440f800a..5575aa88f 100644 --- a/comps/reranks/tei/reranking_tei.py +++ b/comps/reranks/tei/reranking_tei.py @@ -9,7 +9,6 @@ from typing import Union import requests -from langsmith import traceable from comps import ( LLMParamsDoc, @@ -37,7 +36,6 @@ input_datatype=SearchedDoc, output_datatype=LLMParamsDoc, ) -@traceable(run_type="llm") @register_statistics(names=["opea_service@reranking_tgi_gaudi"]) def reranking( input: Union[SearchedDoc, RerankingRequest, ChatCompletionRequest] diff --git a/comps/retrievers/haystack/qdrant/requirements.txt b/comps/retrievers/haystack/qdrant/requirements.txt index 9b99c00fb..24458a6fb 100644 --- a/comps/retrievers/haystack/qdrant/requirements.txt +++ b/comps/retrievers/haystack/qdrant/requirements.txt @@ -3,7 +3,6 @@ easyocr fastapi haystack-ai==2.2.4 langchain_community -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/retrievers/haystack/qdrant/retriever_qdrant.py b/comps/retrievers/haystack/qdrant/retriever_qdrant.py index c2cc8735b..30d1bd72d 100644 --- a/comps/retrievers/haystack/qdrant/retriever_qdrant.py +++ b/comps/retrievers/haystack/qdrant/retriever_qdrant.py @@ -4,7 +4,6 @@ from haystack.components.embedders import HuggingFaceTEITextEmbedder, SentenceTransformersTextEmbedder from haystack_integrations.components.retrievers.qdrant import QdrantEmbeddingRetriever from haystack_integrations.document_stores.qdrant import QdrantDocumentStore -from langsmith import traceable from qdrant_config import EMBED_DIMENSION, EMBED_ENDPOINT, EMBED_MODEL, INDEX_NAME, QDRANT_HOST, QDRANT_PORT from comps import EmbedDoc, SearchedDoc, ServiceType, TextDoc, opea_microservices, register_microservice @@ -28,7 +27,6 @@ def initialize_qdrant_retriever() -> QdrantEmbeddingRetriever: host="0.0.0.0", port=7000, ) -@traceable(run_type="retriever") def retrieve(input: EmbedDoc) -> SearchedDoc: search_res = retriever.run(query_embedding=input.embedding)["documents"] searched_docs = [TextDoc(text=r.content) for r in search_res if r.content] diff --git a/comps/retrievers/langchain/milvus/retriever_milvus.py b/comps/retrievers/langchain/milvus/retriever_milvus.py index 1625eed0a..0c81e76ce 100644 --- a/comps/retrievers/langchain/milvus/retriever_milvus.py +++ b/comps/retrievers/langchain/milvus/retriever_milvus.py @@ -15,9 +15,8 @@ MODEL_ID, MOSEC_EMBEDDING_ENDPOINT, ) -from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings, OpenAIEmbeddings +from langchain_community.embeddings import HuggingFaceBgeEmbeddings, OpenAIEmbeddings from langchain_milvus.vectorstores import Milvus -from langsmith import traceable from comps import ( EmbedDoc, @@ -63,7 +62,6 @@ def empty_embedding() -> List[float]: host="0.0.0.0", port=7000, ) -@traceable(run_type="retriever") @register_statistics(names=["opea_service@retriever_milvus"]) def retrieve(input: EmbedDoc) -> SearchedDoc: vector_db = Milvus( diff --git a/comps/retrievers/langchain/pgvector/requirements.txt b/comps/retrievers/langchain/pgvector/requirements.txt index 18609d361..d3d95dee9 100644 --- a/comps/retrievers/langchain/pgvector/requirements.txt +++ b/comps/retrievers/langchain/pgvector/requirements.txt @@ -2,7 +2,6 @@ docarray[full] easyocr fastapi langchain_community -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/retrievers/langchain/pgvector/retriever_pgvector.py b/comps/retrievers/langchain/pgvector/retriever_pgvector.py index 2fba1f1c0..014a616a5 100644 --- a/comps/retrievers/langchain/pgvector/retriever_pgvector.py +++ b/comps/retrievers/langchain/pgvector/retriever_pgvector.py @@ -7,7 +7,6 @@ from config import EMBED_MODEL, INDEX_NAME, PG_CONNECTION_STRING, PORT from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings from langchain_community.vectorstores import PGVector -from langsmith import traceable from comps import ( EmbedDoc, @@ -30,7 +29,6 @@ host="0.0.0.0", port=PORT, ) -@traceable(run_type="retriever") @register_statistics(names=["opea_service@retriever_pgvector"]) def retrieve(input: EmbedDoc) -> SearchedDoc: start = time.time() diff --git a/comps/retrievers/langchain/pinecone/requirements.txt b/comps/retrievers/langchain/pinecone/requirements.txt index 32df7f40f..7536f591c 100644 --- a/comps/retrievers/langchain/pinecone/requirements.txt +++ b/comps/retrievers/langchain/pinecone/requirements.txt @@ -6,7 +6,6 @@ huggingface_hub langchain langchain-community langchain-pinecone -langsmith numpy opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/retrievers/langchain/pinecone/retriever_pinecone.py b/comps/retrievers/langchain/pinecone/retriever_pinecone.py index ba8e6526f..73e77d111 100644 --- a/comps/retrievers/langchain/pinecone/retriever_pinecone.py +++ b/comps/retrievers/langchain/pinecone/retriever_pinecone.py @@ -7,7 +7,6 @@ from config import EMBED_MODEL, PINECONE_API_KEY, PINECONE_INDEX_NAME from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings from langchain_pinecone import PineconeVectorStore -from langsmith import traceable from pinecone import Pinecone, ServerlessSpec from comps import ( @@ -31,7 +30,6 @@ host="0.0.0.0", port=7000, ) -@traceable(run_type="retriever") @register_statistics(names=["opea_service@retriever_pinecone"]) def retrieve(input: EmbedDoc) -> SearchedDoc: start = time.time() diff --git a/comps/retrievers/langchain/redis/requirements.txt b/comps/retrievers/langchain/redis/requirements.txt index 3720190d3..c68c3d274 100644 --- a/comps/retrievers/langchain/redis/requirements.txt +++ b/comps/retrievers/langchain/redis/requirements.txt @@ -2,7 +2,6 @@ docarray[full] easyocr fastapi langchain_community -langsmith opentelemetry-api opentelemetry-exporter-otlp opentelemetry-sdk diff --git a/comps/retrievers/langchain/redis/retriever_redis.py b/comps/retrievers/langchain/redis/retriever_redis.py index 43f3e0c05..a4ab5dc4e 100644 --- a/comps/retrievers/langchain/redis/retriever_redis.py +++ b/comps/retrievers/langchain/redis/retriever_redis.py @@ -7,7 +7,6 @@ from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings from langchain_community.vectorstores import Redis -from langsmith import traceable from redis_config import EMBED_MODEL, INDEX_NAME, REDIS_URL from comps import ( @@ -37,7 +36,6 @@ host="0.0.0.0", port=7000, ) -@traceable(run_type="retriever") @register_statistics(names=["opea_service@retriever_redis"]) def retrieve( input: Union[EmbedDoc, RetrievalRequest, ChatCompletionRequest] diff --git a/comps/retrievers/llamaindex/requirements.txt b/comps/retrievers/llamaindex/requirements.txt index 236ea9af8..83228c259 100644 --- a/comps/retrievers/llamaindex/requirements.txt +++ b/comps/retrievers/llamaindex/requirements.txt @@ -3,7 +3,6 @@ docarray[full] easyocr fastapi httpx -langsmith llama-index-vector-stores-redis llama_index opentelemetry-api diff --git a/comps/retrievers/llamaindex/retriever_redis.py b/comps/retrievers/llamaindex/retriever_redis.py index 4999a7235..3c387010e 100644 --- a/comps/retrievers/llamaindex/retriever_redis.py +++ b/comps/retrievers/llamaindex/retriever_redis.py @@ -3,7 +3,6 @@ import os -from langsmith import traceable from llama_index.core.vector_stores.types import VectorStoreQuery from llama_index.vector_stores.redis import RedisVectorStore from redis_config import INDEX_NAME, REDIS_URL @@ -20,7 +19,6 @@ host="0.0.0.0", port=7000, ) -@traceable(run_type="retriever") def retrieve(input: EmbedDoc) -> SearchedDoc: vector_store_query = VectorStoreQuery(query_embedding=input.embedding) search_res = vector_store.query(query=vector_store_query) From cd83854f93423a2327f07430fbf781e6f879ce41 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Sun, 18 Aug 2024 19:30:51 +0800 Subject: [PATCH 11/11] Fix CI test changed file detect issue (#512) * update wf Signed-off-by: chensuyue * for test Signed-off-by: chensuyue * remove test code Signed-off-by: chensuyue --------- Signed-off-by: chensuyue --- .github/workflows/_get-test-matrix.yml | 5 ++++- .github/workflows/pr-examples-test.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_get-test-matrix.yml b/.github/workflows/_get-test-matrix.yml index 09be978cb..deedaa949 100644 --- a/.github/workflows/_get-test-matrix.yml +++ b/.github/workflows/_get-test-matrix.yml @@ -38,7 +38,10 @@ jobs: run: | set -xe if [ "${{ github.event_name }}" == "pull_request" ] || [ "${{ github.event_name }}" == "pull_request_target" ]; then - base_commit=${{ github.event.pull_request.base.sha }} + LATEST_COMMIT_SHA=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/opea-project/GenAIComps/commits?sha=main" | jq -r '.[0].sha') + echo "Latest commit SHA is $LATEST_COMMIT_SHA" + base_commit=$LATEST_COMMIT_SHA else base_commit=$(git rev-parse HEAD~1) # push event fi diff --git a/.github/workflows/pr-examples-test.yml b/.github/workflows/pr-examples-test.yml index 302d6f8e1..a3eb50539 100644 --- a/.github/workflows/pr-examples-test.yml +++ b/.github/workflows/pr-examples-test.yml @@ -16,6 +16,7 @@ on: - comps/llms/text-generation/tgi/** - comps/dataprep/redis/langchain/** - requirements.txt + - "!**.md" # If there is a new commit, the previous jobs will be canceled concurrency: