Step 2: Creating Deep Lake Vector Stores
Creating the Deep Lake Vector Store
How to Create a Deep Lake Vector Store
Downloading and Preprocessing the Data
from deeplake.core.vectorstore import VectorStore
import openai
import os!git clone https://github.com/twitter/the-algorithmvector_store_path = '/vector_store_getting_started'
repo_path = '/the-algorithm'CHUNK_SIZE = 1000
chunked_text = []
metadata = []
for dirpath, dirnames, filenames in os.walk(repo_path):
for file in filenames:
try:
full_path = os.path.join(dirpath,file)
with open(full_path, 'r') as f:
text = f.read()
new_chunkned_text = [text[i:i+1000] for i in range(0,len(text), CHUNK_SIZE)]
chunked_text += new_chunkned_text
metadata += [{'filepath': full_path} for i in range(len(new_chunkned_text))]
except Exception as e:
print(e)
passLast updated
Was this helpful?