Skip to content

Commit

Permalink
Added embed_upload_chunks function
Browse files Browse the repository at this point in the history
  • Loading branch information
Meisam984 committed Jun 8, 2023
1 parent 4a945cb commit e80f1dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ def split_to_chunks(docs):

# Embed and upload the split chunks onto Deeplake
def embed_upload_chunks(documents, account_name):
embeddings = OpenAIEmbeddings()
db = DeepLake.from_documents(documents, embeddings, dataset_path=f"hub://{account_name}/langchain-code")
try:
embeddings = OpenAIEmbeddings()
db = DeepLake.from_documents(documents, embeddings, dataset_path=f"hub://{account_name}/langchain-code")
logger.info(f"Uploaded the embedded text chunks unto hub://{account_name}/langchain-code")
except Exception as e:
raise CustomException(e)

return db



0 comments on commit e80f1dc

Please sign in to comment.