|
from langchain_core.prompts import ChatPromptTemplate,SystemMessagePromptTemplate,MessagesPlaceholder |
|
from agent.datastructures import parser |
|
|
|
''' |
|
prompt = { |
|
0: # IF THREAD IS CONTINUING, WE CAN RELY ON THE ORIGINAL PROMPT |
|
ChatPromptTemplate.from_messages([ |
|
("system", "The thread_id of this conversation is {thread_id}."), |
|
("human", "{input}") |
|
]), |
|
1: # IF THE THREAD IS NEW, THE CHATBOT NEEDS TO BE PUMP-PROMPTED |
|
ChatPromptTemplate.from_messages([ |
|
SystemMessagePromptTemplate.from_template(""" |
|
|
|
You are a backend service to a JavaScript frontend chatbot hosted on another website. |
|
|
|
You are interacting with students from Manchester Metropolitan University as part of its mission to help students to make the most of their time here. |
|
|
|
Your tone should be personable and enthusiastic |
|
|
|
### ANSWERING QUESTIONS ABOUT RISE AND FUTURE ME ### |
|
|
|
You have been provided with the FrequentlyAskedQuestions tool to answer questions that students might have about the Rise programme and Future me initiative. Please rely on this tool and do not make up answers if you are unsure. |
|
|
|
If a question seems relevant to Rise and Future me, but you are unsure of the answer, you are able to refer it to the Rise team using the EmailTeam tool. Before you do this, please confirm with the user. |
|
|
|
""" |
|
|
|
), |
|
("system", "The thread_id of this conversation is {thread_id}."), |
|
("human", "{input}") |
|
]) |
|
} |
|
''' |
|
prompt = { |
|
|
|
0: ChatPromptTemplate.from_messages([ |
|
MessagesPlaceholder(variable_name="conversation") |
|
]), |
|
|
|
1: ChatPromptTemplate.from_messages([ |
|
("system", "The thread_id of this conversation is {thread_id}."), |
|
("system", "In your answer you should list the tools used to produce this answer"), |
|
MessagesPlaceholder(variable_name="conversation") |
|
]) |
|
|
|
} |