From a6725695516fb0096097f528862832a970327819 Mon Sep 17 00:00:00 2001 From: XuhuiRen <44249229+XuhuiRen@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:01:58 +0800 Subject: [PATCH] Fix security issue (#673) Signed-off-by: XuhuiRen --- comps/retrievers/qdrant/haystack/requirements.txt | 2 +- comps/retrievers/qdrant/haystack/retriever_qdrant.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comps/retrievers/qdrant/haystack/requirements.txt b/comps/retrievers/qdrant/haystack/requirements.txt index 24458a6fb..dee357a48 100644 --- a/comps/retrievers/qdrant/haystack/requirements.txt +++ b/comps/retrievers/qdrant/haystack/requirements.txt @@ -1,7 +1,7 @@ docarray[full] easyocr fastapi -haystack-ai==2.2.4 +haystack-ai==2.3.1 langchain_community opentelemetry-api opentelemetry-exporter-otlp diff --git a/comps/retrievers/qdrant/haystack/retriever_qdrant.py b/comps/retrievers/qdrant/haystack/retriever_qdrant.py index aee2e6fe1..b942afb15 100644 --- a/comps/retrievers/qdrant/haystack/retriever_qdrant.py +++ b/comps/retrievers/qdrant/haystack/retriever_qdrant.py @@ -3,7 +3,7 @@ import os -from haystack.components.embedders import HuggingFaceTEITextEmbedder, SentenceTransformersTextEmbedder +from haystack.components.embedders import HuggingFaceAPITextEmbedder, SentenceTransformersTextEmbedder from haystack_integrations.components.retrievers.qdrant import QdrantEmbeddingRetriever from haystack_integrations.document_stores.qdrant import QdrantDocumentStore from qdrant_config import EMBED_DIMENSION, EMBED_ENDPOINT, EMBED_MODEL, INDEX_NAME, QDRANT_HOST, QDRANT_PORT @@ -46,7 +46,7 @@ def retrieve(input: EmbedDoc) -> SearchedDoc: if __name__ == "__main__": if EMBED_ENDPOINT: # create embeddings using TEI endpoint service - embedder = HuggingFaceTEITextEmbedder(url=EMBED_ENDPOINT) + embedder = HuggingFaceAPITextEmbedder(api_type="text_embeddings_inference", api_params={"url": EMBED_ENDPOINT}) else: # create embeddings using local embedding model embedder = SentenceTransformersTextEmbedder(model=EMBED_MODEL)