test1
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from PyPDF2 import PdfReader
|
|
| 4 |
import openpyxl
|
| 5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 6 |
from langchain.embeddings import GooglePalmEmbeddings
|
| 7 |
-
from langchain.llms import
|
| 8 |
from langchain.vectorstores import FAISS
|
| 9 |
from langchain.chains import ConversationalRetrievalChain
|
| 10 |
from langchain.memory import ConversationBufferMemory
|
|
@@ -41,7 +41,7 @@ def get_vector_store(text_chunks):
|
|
| 41 |
return vector_store
|
| 42 |
|
| 43 |
def get_conversational_chain(vector_store):
|
| 44 |
-
llm =
|
| 45 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
| 46 |
conversation_chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=vector_store.as_retriever(), memory=memory)
|
| 47 |
return conversation_chain
|
|
|
|
| 4 |
import openpyxl
|
| 5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 6 |
from langchain.embeddings import GooglePalmEmbeddings
|
| 7 |
+
from langchain.llms import HuggingFaceTransformers # Updated import
|
| 8 |
from langchain.vectorstores import FAISS
|
| 9 |
from langchain.chains import ConversationalRetrievalChain
|
| 10 |
from langchain.memory import ConversationBufferMemory
|
|
|
|
| 41 |
return vector_store
|
| 42 |
|
| 43 |
def get_conversational_chain(vector_store):
|
| 44 |
+
llm = HuggingFaceTransformers(model_name="HanNayeoniee/LHK_DPO_v1")
|
| 45 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
| 46 |
conversation_chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=vector_store.as_retriever(), memory=memory)
|
| 47 |
return conversation_chain
|