How Load a premade LanceDB vector database with LangChain? #1068
-
Hi, Is it possible to load a premade LanceDB vector database with LangChain? I.e. instead of having to run something like this everytime: from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.vectorstores import LanceDB
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=20)
all_splits = text_splitter.split_documents(data)
vectorstore = LanceDB.from_documents(documents=all_splits, embeddings) maybe I can run this once and then load it via something like: vectorstore = LanceDB.from_store("/path/to/lancedb") Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
raghavdixit99
Mar 7, 2024
Replies: 1 comment
-
Hi , db = lancedb.connect('./lancedb')
table = db.open_table('my_table')
vectorstore = LanceDB(table, embedding_function)
vectorstore.add_texts(['text1', 'text2'])
result = vectorstore.similarity_search('text1') |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
asmith26
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi ,
We currently support adding connection object as an argument to our integration, we don't have a method inplace to directly load the full vectordb from local path(uri) yet we will be releasing additional features in our langchain integration soon, You can use the following to pass an pre-existing table for now: