#test that vector database is working retriever = db.as_retriever(search_kwargs={"k": 3}) #create a prompt template template = """<|user|> Relevant information: {context} Provide a concise answer to the following question using relevant information provided above: {question} If the information above does not answer the question, say that you do not know. Keep answers to 3 sentences or shorter.<|end|> <|assistant|>""" #define prompt template prompt = PromptTemplate( template=template, input_variables=["context", "question"]) #create RAG pipeline rag = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever, return_source_documents=True, chain_type_kwargs={"prompt": prompt}, verbose = True) #test rag response rag.invoke("What are the most recent advancements in computer vision?")