Skip to content

Commit 6332d80

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

File tree

6 files changed

+15
-26
lines changed

6 files changed

+15
-26
lines changed

comps/dataprep/deployment/docker_compose/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ services:
213213
timeout: 5s
214214
retries: 10
215215
restart: unless-stopped
216-
216+
217217
dataprep-pgvector:
218218
image: ${REGISTRY:-opea}/dataprep:${TAG:-latest}
219219
container_name: dataprep-pgvector-server

comps/dataprep/src/integrations/opengauss.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

@@ -12,8 +12,8 @@
1212
from fastapi import Body, File, Form, HTTPException, UploadFile
1313
from langchain.text_splitter import RecursiveCharacterTextSplitter
1414
from langchain_community.embeddings import HuggingFaceBgeEmbeddings, HuggingFaceInferenceAPIEmbeddings
15-
from langchain_opengauss import OpenGauss, OpenGaussSettings
1615
from langchain_huggingface import HuggingFaceEmbeddings
16+
from langchain_opengauss import OpenGauss, OpenGaussSettings
1717

1818
from comps import CustomLogger, DocPath, OpeaComponent, OpeaComponentRegistry, ServiceType
1919
from comps.cores.proto.api_protocol import DataprepRequest
@@ -94,12 +94,7 @@ def check_health(self) -> bool:
9494
port = result.port
9595
psycopg2.connect(database=database, user=username, password=password, host=hostname, port=port)
9696
self.opengauss_config = OpenGaussSettings(
97-
host=hostname,
98-
port=port,
99-
user=username,
100-
password=password,
101-
database=database,
102-
embedding_dimension=768
97+
host=hostname, port=port, user=username, password=password, database=database, embedding_dimension=768
10398
)
10499
return True
105100
except psycopg2.Error as e:
@@ -200,10 +195,7 @@ async def ingest_doc_to_opengauss(self, doc_path: DocPath):
200195
batch_metadatas = metadatas[i : i + batch_size]
201196
batch_texts = batch_chunks
202197
_ = OpenGauss.from_texts(
203-
texts=batch_texts,
204-
embedding=self.embedder,
205-
metadatas=batch_metadatas,
206-
config=self.opengauss_config
198+
texts=batch_texts, embedding=self.embedder, metadatas=batch_metadatas, config=self.opengauss_config
207199
)
208200
if logflag:
209201
logger.info(f"Processed batch {i//batch_size + 1}/{(num_chunks-1)//batch_size + 1}")
@@ -237,10 +229,7 @@ async def ingest_link_to_opengauss(self, link_list: List[str]):
237229
batch_texts = batch_chunks
238230

239231
_ = OpenGauss.from_texts(
240-
texts=batch_texts,
241-
embedding=self.embedder,
242-
metadatas=batch_metadatas,
243-
config=self.opengauss_config
232+
texts=batch_texts, embedding=self.embedder, metadatas=batch_metadatas, config=self.opengauss_config
244233
)
245234
if logflag:
246235
logger.info(f"Processed batch {i//batch_size + 1}/{(num_chunks-1)//batch_size + 1}")
@@ -375,4 +364,4 @@ async def delete_files(self, file_path: str = Body(..., embed=True)):
375364
logger.info({"status": True})
376365
return {"status": True}
377366
else:
378-
raise HTTPException(status_code=404, detail="File/folder not found. Please check del_path.")
367+
raise HTTPException(status_code=404, detail="File/folder not found. Please check del_path.")

comps/dataprep/src/opea_dataprep_microservice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
from integrations.mariadb import OpeaMariaDBDataprep
1313
from integrations.milvus import OpeaMilvusDataprep
1414
from integrations.neo4j_llamaindex import OpeaNeo4jLlamaIndexDataprep
15+
from integrations.opengauss import OpeaOpenGaussDataprep
1516
from integrations.opensearch import OpeaOpenSearchDataprep
1617
from integrations.pgvect import OpeaPgvectorDataprep
1718
from integrations.pipecone import OpeaPineConeDataprep
1819
from integrations.qdrant import OpeaQdrantDataprep
1920
from integrations.redis import OpeaRedisDataprep
2021
from integrations.redis_finance import OpeaRedisDataprepFinance
2122
from integrations.vdms import OpeaVdmsDataprep
22-
from integrations.opengauss import OpeaOpenGaussDataprep
2323
from opea_dataprep_loader import OpeaDataprepLoader
2424

2525
from comps import (
@@ -253,4 +253,4 @@ async def get_list_of_indices():
253253
if __name__ == "__main__":
254254
logger.info("OPEA Dataprep Microservice is starting...")
255255
create_upload_folder(upload_folder)
256-
opea_microservices["opea_service@dataprep"].start()
256+
opea_microservices["opea_service@dataprep"].start()

comps/dataprep/src/requirements-cpu.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,9 @@ langchain-mariadb==0.0.17
401401
# via -r ./comps/dataprep/src/requirements.in
402402
langchain-milvus==0.1.10
403403
# via -r ./comps/dataprep/src/requirements.in
404-
langchain-opengauss==0.1.4
405-
# via -r ./comps/dataprep/src/requirements.in
406404
langchain-openai==0.3.23
405+
# via -r ./comps/dataprep/src/requirements.in
406+
langchain-opengauss==0.1.4
407407
# via
408408
# -r ./comps/dataprep/src/requirements.in
409409
# langchain-pinecone

comps/third_parties/opengauss/deployment/docker_compose/compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
services:
@@ -16,4 +16,4 @@ services:
1616
interval: 60s
1717
retries: 3
1818
start_period: 10s
19-
timeout: 10s
19+
timeout: 10s

tests/dataprep/test_dataprep_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
@@ -101,4 +101,4 @@ function main() {
101101

102102
}
103103

104-
main
104+
main

0 commit comments

Comments
 (0)