File size: 2,340 Bytes
224ff63
a0503bc
76c5345
224ff63
796ceef
dbf2f6d
 
 
 
 
 
796ceef
 
8b9c87b
 
76c5345
8b9c87b
 
 
 
 
76c5345
8b9c87b
76c5345
224ff63
 
796ceef
 
224ff63
dbf2f6d
796ceef
dbf2f6d
224ff63
 
 
 
 
 
 
 
 
46fc259
224ff63
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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")
         ])
          
    }