zakerytclarke commited on
Commit
e972582
·
verified ·
1 Parent(s): 2c24fc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -60,7 +60,7 @@ def brave_search(query, count=3):
60
 
61
  @traceable
62
  @log_time
63
- def query_teapot(prompt, context, user_input, teapot_ai):
64
  input_text = prompt + "\n" + context + "\n" + user_input
65
 
66
  start_time = time.time()
@@ -83,7 +83,7 @@ def query_teapot(prompt, context, user_input, teapot_ai):
83
 
84
 
85
  @log_time
86
- def handle_chat(user_prompt, user_input, teapot_ai):
87
  with st.chat_message("user"):
88
  st.markdown(user_input)
89
  st.session_state.messages.append({"role": "user", "content": user_input})
@@ -102,7 +102,7 @@ def handle_chat(user_prompt, user_input, teapot_ai):
102
 
103
  context = "\n".join(documents)
104
  prompt = """You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization. If a user asks who you are reply "I am Teapot"."""
105
- response = query_teapot(prompt, context+user_prompt, user_input, teapot_ai)
106
 
107
  with st.chat_message("assistant"):
108
  st.markdown(response)
@@ -156,7 +156,7 @@ def main():
156
 
157
  if user_input:
158
  with st.spinner('Generating Response...'):
159
- response = handle_chat(user_prompt, user_suggested_input or user_input, teapot_ai)
160
 
161
 
162
  if __name__ == "__main__":
 
60
 
61
  @traceable
62
  @log_time
63
+ def query_teapot(prompt, context, user_input):
64
  input_text = prompt + "\n" + context + "\n" + user_input
65
 
66
  start_time = time.time()
 
83
 
84
 
85
  @log_time
86
+ def handle_chat(user_prompt, user_input):
87
  with st.chat_message("user"):
88
  st.markdown(user_input)
89
  st.session_state.messages.append({"role": "user", "content": user_input})
 
102
 
103
  context = "\n".join(documents)
104
  prompt = """You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization. If a user asks who you are reply "I am Teapot"."""
105
+ response = query_teapot(prompt, context+user_prompt, user_input)
106
 
107
  with st.chat_message("assistant"):
108
  st.markdown(response)
 
156
 
157
  if user_input:
158
  with st.spinner('Generating Response...'):
159
+ response = handle_chat(user_prompt, user_suggested_input or user_input)
160
 
161
 
162
  if __name__ == "__main__":