Rohan Kataria commited on
Commit
dc9eb63
·
1 Parent(s): faaa346
Files changed (1) hide show
  1. src/main.py +2 -3
src/main.py CHANGED
@@ -16,7 +16,7 @@ from langchain.llms import OpenAI
16
  from langchain.memory import ConversationBufferMemory
17
  from langchain.vectorstores import Chroma
18
  from langchain.embeddings.openai import OpenAIEmbeddings
19
- from langchain.prompts import PromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, ChatPromptTemplate
20
  import datetime
21
  import shutil
22
 
@@ -87,8 +87,6 @@ def retreival(vector_store, k):
87
 
88
  CONTEXT: {context}
89
  =======
90
- CHAT HISTORY: {chat_history}
91
- =======
92
  FINAL ANSWER:"""
93
 
94
  human_template = """{question}"""
@@ -99,6 +97,7 @@ def retreival(vector_store, k):
99
  # Create the chat prompt templates
100
  messages = [
101
  SystemMessagePromptTemplate.from_template(system_template),
 
102
  HumanMessagePromptTemplate.from_template(human_template),
103
  # AIMessagePromptTemplate.from_template(ai_template)
104
  ]
 
16
  from langchain.memory import ConversationBufferMemory
17
  from langchain.vectorstores import Chroma
18
  from langchain.embeddings.openai import OpenAIEmbeddings
19
+ from langchain.prompts import PromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, ChatPromptTemplate, MessagesPlaceholder
20
  import datetime
21
  import shutil
22
 
 
87
 
88
  CONTEXT: {context}
89
  =======
 
 
90
  FINAL ANSWER:"""
91
 
92
  human_template = """{question}"""
 
97
  # Create the chat prompt templates
98
  messages = [
99
  SystemMessagePromptTemplate.from_template(system_template),
100
+ MessagesPlaceholder(variable_name="chat_history"),
101
  HumanMessagePromptTemplate.from_template(human_template),
102
  # AIMessagePromptTemplate.from_template(ai_template)
103
  ]