How to build the vector store when there are already documents in corpus

Hi,

As I have already post my documents in corpus via API, how do I build vectara vectorestore ?

A normal procedure for example

from langchain.vectorstores import Vectara
loader = TextLoader(“state_of_the_union.txt”)
documents = loader.load()
vectorstore= Vectara.from_documents(documents, embedding = None)
retriever = Vectara.as_retriever(vectorstore)

I believe I do not need the codes from_documents() for loading documents because of my case.

Is there sort of way like Vectara.from_documents but from corpus directly for building vectore store so I don’t have to change my ongoing langchain pipeline as where retriever is build by Vectara.as_retriever(vectorstore) ?

Thanks for any hints.
Xiangyu

Hi,
I think this flow could work:

vectorstore = Vectara(
vectara_customer_id=<CUSTOMER_ID>,
vectara_corpus_id=<CORPUS_ID>,
vectara_api_key=<YOUR_VECTARA_API_KEY>
)

and then you can use
retriever = Vectara.as_retriever(vectorstore)

Can you please let me know if this works?
Ofer

Thanks a lot ofer, it works!