aheman20 commited on
Commit
8c7a0e7
1 Parent(s): 84aa7e9

added prompt again

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -7,7 +7,7 @@ from langchain.chains import ConversationalRetrievalChain
7
  from langchain.chat_models import ChatOpenAI
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain.vectorstores import Pinecone
10
- from langchian.prompts.prompt import PromptTemplate
11
 
12
 
13
  BOOK_TOKEN = os.getenv("book")
@@ -58,17 +58,17 @@ with gr.Blocks() as demo:
58
  return_messages=False
59
  )
60
 
61
- #PUT IT IN A PROMPT TEMPLATE
62
- #template = """The following is chat between a human and an AI assistant. The AI provides the answer along with the section it referred to for the answer.
63
- #Current Conversation:
64
- #{history}
65
- #Friend: {input}
66
- #AI:
67
- #"""
68
- #PROMPT = PromptTemplate(input_variables=["history", "input"], template=template)
69
 
70
  #Initalize lanchain - Conversation Retrieval Chain
71
- qa = ConversationalRetrievalChain.from_llm(ChatOpenAI(temperature=0), retriever=db.as_retriever(), memory=memory)
72
 
73
 
74
 
 
7
  from langchain.chat_models import ChatOpenAI
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain.vectorstores import Pinecone
10
+ from langchain.prompts.prompt import PromptTemplate
11
 
12
 
13
  BOOK_TOKEN = os.getenv("book")
 
58
  return_messages=False
59
  )
60
 
61
+ PUT IT IN A PROMPT TEMPLATE
62
+ template = """The following is chat between a human and an AI assistant. The AI provides the answer along with the section it referred to for the answer.
63
+ Current Conversation:
64
+ {history}
65
+ Friend: {input}
66
+ AI:
67
+ """
68
+ PROMPT = PromptTemplate(input_variables=["history", "input"], template=template)
69
 
70
  #Initalize lanchain - Conversation Retrieval Chain
71
+ qa = ConversationalRetrievalChain.from_llm(ChatOpenAI(temperature=0), retriever=db.as_retriever(), memory=memory, prompt=PROMPT)
72
 
73
 
74