Skip to content

Commit f134507

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f258f60 commit f134507

5 files changed

Lines changed: 12 additions & 21 deletions

File tree

comps/retrievers/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ For details, please refer to this [readme](src/README_arangodb.md)
5252

5353
## Retriever Microservice with openGauss
5454

55-
For details, please refer to this [readme](src/README_opengauss.md)
55+
For details, please refer to this [readme](src/README_opengauss.md)

comps/retrievers/src/integrations/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,4 @@ def format_opensearch_conn_from_env():
252252
# MariaDB Vector #
253253
#######################################################
254254
MARIADB_CONNECTION_URL = os.getenv("MARIADB_CONNECTION_URL", "localhost")
255-
MARIADB_COLLECTION_NAME = os.getenv("MARIADB_COLLECTION_NAME", "rag_mariadbvector")
255+
MARIADB_COLLECTION_NAME = os.getenv("MARIADB_COLLECTION_NAME", "rag_mariadbvector")

comps/retrievers/src/integrations/opengauss.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
1+
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
22
# SPDX-License-Identifier: Apache-2.0
33

44

55
import os
6+
from urllib.parse import urlparse
67

78
from fastapi import HTTPException
89
from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
9-
from langchain_opengauss import OpenGauss, OpenGaussSettings
1010
from langchain_huggingface import HuggingFaceEmbeddings
11-
from urllib.parse import urlparse
11+
from langchain_opengauss import OpenGauss, OpenGaussSettings
1212

1313
from comps import CustomLogger, EmbedDoc, OpeaComponent, OpeaComponentRegistry, ServiceType
1414

15-
from .config import EMBED_MODEL, HF_TOKEN, GS_CONNECTION_STRING, GS_INDEX_NAME, TEI_EMBEDDING_ENDPOINT
15+
from .config import EMBED_MODEL, GS_CONNECTION_STRING, GS_INDEX_NAME, HF_TOKEN, TEI_EMBEDDING_ENDPOINT
1616

1717
logger = CustomLogger("opengauss_retrievers")
1818
logflag = os.getenv("LOGFLAG", False)
@@ -75,17 +75,9 @@ def _initialize_client(self) -> OpenGauss:
7575
port = result.port
7676

7777
self.opengauss_config = OpenGaussSettings(
78-
host=hostname,
79-
port=port,
80-
user=username,
81-
password=password,
82-
database=database,
83-
embedding_dimension=768
84-
)
85-
vector_db = OpenGauss(
86-
embedding=self.embedder,
87-
config=self.opengauss_config
78+
host=hostname, port=port, user=username, password=password, database=database, embedding_dimension=768
8879
)
80+
vector_db = OpenGauss(embedding=self.embedder, config=self.opengauss_config)
8981
return vector_db
9082

9183
def check_health(self) -> bool:
@@ -101,7 +93,6 @@ def check_health(self) -> bool:
10193
hostname = result.hostname
10294
port = result.port
10395

104-
10596
if logflag:
10697
logger.info("[ check health ] start to check health of openGauss")
10798
try:
@@ -128,4 +119,4 @@ async def invoke(self, input: EmbedDoc) -> list:
128119

129120
if logflag:
130121
logger.info(f"[ similarity search ] search result: {search_res}")
131-
return search_res
122+
return search_res

comps/retrievers/src/opea_retrievers_microservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
from integrations.mariadb import OpeaMARIADBVectorRetriever
1414
from integrations.milvus import OpeaMilvusRetriever
1515
from integrations.neo4j import OpeaNeo4jRetriever
16+
from integrations.opengauss import OpeaOpenGaussRetriever
1617
from integrations.opensearch import OpeaOpensearchRetriever
1718
from integrations.pathway import OpeaPathwayRetriever
1819
from integrations.pgvector import OpeaPGVectorRetriever
1920
from integrations.pinecone import OpeaPineconeRetriever
2021
from integrations.qdrant import OpeaQDrantRetriever
2122
from integrations.redis import OpeaRedisRetriever
2223
from integrations.vdms import OpeaVDMsRetriever
23-
from integrations.opengauss import OpeaOpenGaussRetriever
2424

2525
from comps import (
2626
CustomLogger,

tests/retrievers/test_retrievers_opengauss.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
2+
# Copyright (C) 2025 Huawei Technologies Co., Ltd.
33
# SPDX-License-Identifier: Apache-2.0
44

55
set -x
@@ -81,4 +81,4 @@ function main() {
8181

8282
}
8383

84-
main
84+
main

0 commit comments

Comments
 (0)