ofermend commited on
Commit
53233bd
1 Parent(s): a427753
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -22,18 +22,18 @@ initial_prompt = "How can I help you today?"
22
  def create_tools(cfg):
23
 
24
  def adjust_response_to_student(
25
- text: str = Field(description='the original text.'),
26
  age: int = Field(description='the age of the student. An integer'),
27
  style: str = Field(description='teaching style'),
28
  language: str = Field(description='the language')
29
 
30
  ) -> str:
31
  """
32
- Rephrase the text to match the student's age, desired teaching style and language
33
  """
34
  instructions = f'''
35
- The following is response the teacher is planning to provide to a student based on their question.
36
- Please adjust the response to match the student's age of {age}, the {style} teaching style.
37
  For example, in the inquiry-based teaching style, choose to ask questions that encourage the student to think critically instead of repsonding directly with the answer.
38
  Or in the socratic teaching style, choose to ask questions that lead the student to the answer.
39
  Always respond in the {language} language.''' \
@@ -84,8 +84,10 @@ def initialize_agent(_cfg):
84
  - Obtain information using tools to answer the user's query.
85
  - If the tool cannot provide information relevant to the user's query, tell the user that you are unable to provide an answer.
86
  - If the tool can provide relevant information, use the adjust_response_to_student tool
87
- to rephrase the response to ensure it fits the student's age of {_cfg.student_age},
88
  the {_cfg.style} teaching style and the {_cfg.language} language.
 
 
89
  - Response in a concise and clear manner, and provide the most relevant information to the student.
90
  - Never discuss politics, and always respond politely.
91
  """
@@ -138,7 +140,7 @@ def launch_bot():
138
  # left side content
139
  with st.sidebar:
140
  image = Image.open('Vectara-logo.png')
141
- st.image(image, width=250)
142
  st.markdown("## Welcome to the Justice Harvard e-learning assistant demo.\n\n\n")
143
 
144
  st.markdown("\n")
 
22
  def create_tools(cfg):
23
 
24
  def adjust_response_to_student(
25
+ text: str = Field(description='the text to adjust. may include citations in markdown format.'),
26
  age: int = Field(description='the age of the student. An integer'),
27
  style: str = Field(description='teaching style'),
28
  language: str = Field(description='the language')
29
 
30
  ) -> str:
31
  """
32
+ Rephrase the provided text to match the student's age, desired teaching style and language
33
  """
34
  instructions = f'''
35
+ The following is some text.
36
+ Adjust the response to match the student's age of {age}, the {style} teaching style.
37
  For example, in the inquiry-based teaching style, choose to ask questions that encourage the student to think critically instead of repsonding directly with the answer.
38
  Or in the socratic teaching style, choose to ask questions that lead the student to the answer.
39
  Always respond in the {language} language.''' \
 
84
  - Obtain information using tools to answer the user's query.
85
  - If the tool cannot provide information relevant to the user's query, tell the user that you are unable to provide an answer.
86
  - If the tool can provide relevant information, use the adjust_response_to_student tool
87
+ to rephrase the text (including citations if any) to ensure it fits the student's age of {_cfg.student_age},
88
  the {_cfg.style} teaching style and the {_cfg.language} language.
89
+ - When showing citations, adjust the URL to incorporate the start time of the video, as included in the metadata.
90
+ - When showing citations, use sequential numbers to reference the citations.
91
  - Response in a concise and clear manner, and provide the most relevant information to the student.
92
  - Never discuss politics, and always respond politely.
93
  """
 
140
  # left side content
141
  with st.sidebar:
142
  image = Image.open('Vectara-logo.png')
143
+ st.image(image, width=175)
144
  st.markdown("## Welcome to the Justice Harvard e-learning assistant demo.\n\n\n")
145
 
146
  st.markdown("\n")