from langchain_openai import OpenAIEmbeddings from langchain_community.vectorstores.faiss import FAISS from langchain.chains import RetrievalQA from langchain_openai import OpenAI from dotenv import load_dotenv load_dotenv(); # Get question question="I would like to be a teacher, can you recommend an activity?"; # Load from local storage embeddings = OpenAIEmbeddings() persisted_vectorstore = FAISS.load_local("_rise_product_db", embeddings) # Use RetrievalQA chain for orchestration qa = RetrievalQA.from_chain_type(llm=OpenAI(), chain_type="stuff", retriever=persisted_vectorstore.as_retriever()) result = qa.invoke(question) print(result)