Update chatbot.py
Browse files- chatbot.py +3 -3
chatbot.py
CHANGED
@@ -26,7 +26,7 @@ booking process.
|
|
26 |
Current conversation:
|
27 |
{history}
|
28 |
|
29 |
-
Human: {
|
30 |
AI: [/INST]"""
|
31 |
|
32 |
#@st.cache_resource
|
@@ -68,7 +68,7 @@ def demo_miny_memory():
|
|
68 |
|
69 |
def demo_chain(input_text,history):
|
70 |
#PROMPT = ChatPromptTemplate.from_template(template)
|
71 |
-
PROMPT =
|
72 |
conversation = ConversationChain(
|
73 |
prompt=PROMPT,
|
74 |
llm=llm,
|
@@ -78,4 +78,4 @@ def demo_chain(input_text,history):
|
|
78 |
)
|
79 |
|
80 |
chat_reply = conversation.invoke(input=input_text, max_new_tokens = 100)
|
81 |
-
return chat_reply
|
|
|
26 |
Current conversation:
|
27 |
{history}
|
28 |
|
29 |
+
Human: {input}
|
30 |
AI: [/INST]"""
|
31 |
|
32 |
#@st.cache_resource
|
|
|
68 |
|
69 |
def demo_chain(input_text,history):
|
70 |
#PROMPT = ChatPromptTemplate.from_template(template)
|
71 |
+
PROMPT = PromptTemplate(template=template, input_variables=["history", "input"])
|
72 |
conversation = ConversationChain(
|
73 |
prompt=PROMPT,
|
74 |
llm=llm,
|
|
|
78 |
)
|
79 |
|
80 |
chat_reply = conversation.invoke(input=input_text, max_new_tokens = 100)
|
81 |
+
return chat_reply.split('AI:')[-1]
|