Query an already Uploaded Corpus with langchain

Hey , Im struggling to find a example to query a already uploaded corpus on vectara with langchain and a llm . All examples I find always upload the documents first I don’t want to upload them every time I want to query I would like to query the already uploaded data in the DB . I would be super thankful if someone could point me to some ideas how to do this !

Thank you so much !
Regards

Certainly. Here’s an example

from langchain.chains import RetrievalQA
from langchain.vectorstores.vectara import Vectara
from langchain.chat_models.openai import ChatOpenAI

# assuming the following information is the environment
# pointing to the existing vectara customer_id and corpus_id that's already populated with data 
import os
os.environ['VECTARA_API_KEY'] = os.environ['VECTARA_API_KEY']
os.environ['VECTARA_CORPUS_ID'] = os.environ['VECTARA_CORPUS_ID']
os.environ['VECTARA_CUSTOMER_ID'] = os.environ['VECTARA_CUSTOMER_ID']

query = "YOUR QUERY HERE"
llm = ChatOpenAI(model_name = 'gpt-3.5-turbo', temperature=0)
retriever = Vectara().as_retriever(search_kwargs={'k': 10})
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever)
qa.run(query)