Spaces:
Runtime error
Runtime error
Upload app.py
Browse files65 unmodified lines666768697071723 unmodified lines76777879808182838485868788899065 unmodified lines# --- Step 7: Setup memory and QA chain ---memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)prompt = PromptTemplate.from_template("""You are a helpful assistant at the University of Hertfordshire. Use the context below to answer the question clearly and factually.If the answer is not in the context, say you don't know.3 unmodified linesQuestion:{question}Helpful Answer:""")qa_chain = ConversationalRetrievalChain.from_llm(llm=llm,retriever=vectordb.as_retriever(search_kwargs={"k": 3}),memory=memory,chain_type="map_reduce",combine_docs_chain_kwargs={"combine_prompt": prompt})# --- Step 8: Define chatbot logic ---65 unmodified lines666768697071723 unmodified lines76777879808182838485868788899065 unmodified lines# --- Step 7: Setup memory and QA chain ---memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)custom_prompt = PromptTemplate.from_template("""You are a helpful assistant at the University of Hertfordshire. Use the context below to answer the question clearly and factually.If the answer is not in the context, say you don't know.3 unmodified linesQuestion:{question}Answer:""")qa_chain = ConversationalRetrievalChain.from_llm(llm=llm,retriever=vectordb.as_retriever(search_kwargs={"k": 3}),memory=memory,chain_type="stuff",combine_docs_chain_kwargs={"prompt": custom_prompt})# --- Step 8: Define chatbot logic ---
app.py+4-4