Skip to content

Commit 7569e7c

Browse files
update pathway vector store, fix tests (opea-project#940)
Signed-off-by: Berke <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6c2b466 commit 7569e7c

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
langchain
2+
langchain-community
3+
langchain_huggingface
14
langchain_openai
2-
pathway[xpack-llm] >= 0.14.1
5+
pathway[xpack-llm]
36
sentence-transformers
4-
unstructured[all-docs] >= 0.10.28,<0.15
7+
unstructured[all-docs] >= 0.16

comps/vectorstores/pathway/vectorstore_pathway.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
import pathway as pw
88
from langchain import text_splitter
9-
from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceHubEmbeddings
9+
from langchain_community.embeddings import HuggingFaceBgeEmbeddings
10+
from langchain_huggingface import HuggingFaceEndpointEmbeddings
1011
from pathway.xpacks.llm.parsers import ParseUnstructured
1112
from pathway.xpacks.llm.vector_store import VectorStoreServer
1213

@@ -42,7 +43,7 @@
4243
if tei_embedding_endpoint:
4344
# create embeddings using TEI endpoint service
4445
logging.info(f"Initializing the embedder from tei_embedding_endpoint: {tei_embedding_endpoint}")
45-
embeddings = HuggingFaceHubEmbeddings(model=tei_embedding_endpoint)
46+
embeddings = HuggingFaceEndpointEmbeddings(model=tei_embedding_endpoint)
4647
else:
4748
# create embeddings using local embedding model
4849
embeddings = HuggingFaceBgeEmbeddings(model_name=EMBED_MODEL)

tests/vectorstores/test_vectorstores_pathway.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function start_service() {
4747

4848
docker run -d --name="test-comps-vectorstore-pathway-ms" -e PATHWAY_HOST=${PATHWAY_HOST} -e PATHWAY_PORT=${PATHWAY_PORT} -e TEI_EMBEDDING_ENDPOINT=${TEI_EMBEDDING_ENDPOINT} -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v $WORKPATH/comps/vectorstores/pathway/README.md:/app/data/README.md -p ${PATHWAY_PORT}:${PATHWAY_PORT} --network="host" opea/vectorstore-pathway:comps
4949

50-
sleep 45s
50+
sleep 70s
5151

5252
export PATHWAY_HOST=$ip_address # needed in order to reach to vector store
5353

@@ -60,8 +60,15 @@ function validate_microservice() {
6060
result=$(http_proxy=''
6161
curl http://${PATHWAY_HOST}:$PATHWAY_PORT/v1/retrieve \
6262
-X POST \
63-
-d "{\"query\":\"test\",\"k\":3}" \
63+
-d "{\"query\":\"pathway\",\"k\":5}" \
6464
-H 'Content-Type: application/json')
65+
66+
docs=$(http_proxy=''
67+
curl http://${PATHWAY_HOST}:$PATHWAY_PORT/v1/inputs \
68+
-X POST \
69+
-H 'Content-Type: application/json')
70+
71+
echo "Indexed documents: $docs"
6572
if [[ $result == *"Pathway"* ]]; then
6673
echo "Result correct."
6774
else

0 commit comments

Comments
 (0)