Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci

Signed-off-by: pallavi jaini <[email protected]>
  • Loading branch information
pre-commit-ci[bot] authored and pallavijaini0525 committed Aug 8, 2024
1 parent ae7a93c commit 4106720
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions comps/dataprep/pinecone/prepare_doc_pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def check_index_existance():
else:
return True


def create_index(client):
print(f"[ create index ] creating index {PINECONE_INDEX_NAME}")
try:
Expand All @@ -59,6 +60,7 @@ def create_index(client):
return False
return True


def drop_index(index_name):
print(f"[ drop index ] dropping index {index_name}")
pc = Pinecone(api_key=PINECONE_API_KEY)
Expand All @@ -70,6 +72,7 @@ def drop_index(index_name):
return False
return True


def ingest_data_to_pinecone(doc_path: DocPath):
"""Ingest document to Pinecone."""
path = doc_path.path
Expand Down Expand Up @@ -107,12 +110,11 @@ def ingest_data_to_pinecone(doc_path: DocPath):

pc = Pinecone(api_key=PINECONE_API_KEY)

#Checking Index existance
if (not check_index_existance()):
# Checking Index existence
if not check_index_existance():
# Creating the index
create_index(pc)
print("Successfully created the index", PINECONE_INDEX_NAME)


# Batch size
batch_size = 32
Expand Down Expand Up @@ -145,8 +147,8 @@ async def ingest_link_to_pinecone(link_list: List[str]):

pc = Pinecone(api_key=PINECONE_API_KEY)

#Checking Index existance
if (not check_index_existance()):
# Checking Index existence
if not check_index_existance():
# Creating the index
create_index(pc)
print("Successfully created the index", PINECONE_INDEX_NAME)
Expand Down Expand Up @@ -254,7 +256,7 @@ async def delete_all(file_path: str = Body(..., embed=True)):
else:
raise HTTPException(status_code=404, detail="Single file deletion is not implemented yet")


if __name__ == "__main__":
create_upload_folder(upload_folder)
opea_microservices["opea_service@prepare_doc_pinecone"].start()
Expand Down

0 comments on commit 4106720

Please sign in to comment.