Spaces:
Sleeping
Sleeping
Update langchain_utils.py
Browse files- langchain_utils.py +3 -3
langchain_utils.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
from langchain_core.output_parsers import StrOutputParser
|
3 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
4 |
from langchain.chains import create_history_aware_retriever, create_retrieval_chain
|
@@ -40,8 +40,8 @@ qa_prompt = ChatPromptTemplate.from_messages([
|
|
40 |
|
41 |
|
42 |
|
43 |
-
def get_rag_chain(model="
|
44 |
-
llm =
|
45 |
history_aware_retriever = create_history_aware_retriever(llm, retriever, contextualize_q_prompt)
|
46 |
question_answer_chain = create_stuff_documents_chain(llm, qa_prompt)
|
47 |
rag_chain = create_retrieval_chain(history_aware_retriever, question_answer_chain)
|
|
|
1 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
2 |
from langchain_core.output_parsers import StrOutputParser
|
3 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
4 |
from langchain.chains import create_history_aware_retriever, create_retrieval_chain
|
|
|
40 |
|
41 |
|
42 |
|
43 |
+
def get_rag_chain(model="gemini-1.0-pro"):
|
44 |
+
llm = ChatGoogleGenerativeAI(model=model,convert_system_message_to_human=True)
|
45 |
history_aware_retriever = create_history_aware_retriever(llm, retriever, contextualize_q_prompt)
|
46 |
question_answer_chain = create_stuff_documents_chain(llm, qa_prompt)
|
47 |
rag_chain = create_retrieval_chain(history_aware_retriever, question_answer_chain)
|