zakerytclarke commited on
Commit
e7373ce
·
verified ·
1 Parent(s): 577cbf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -36,18 +36,24 @@ def handle_chat(user_input, teapot_ai):
36
  for i, (title, description, url) in enumerate(results, 1):
37
  documents.append(description.replace('<strong>','').replace('</strong>',''))
38
  print(documents)
39
- teapotai = TeapotAI(documents=documents, settings=TeapotAISettings(rag_num_results=3))
 
 
 
 
 
 
40
 
41
- response = teapot_ai.chat([
42
- {
43
- "role": "system",
44
- "content": "You are Teapot, an open-source AI assistant optimized for running efficiently on low-end devices. You provide short, accurate responses without hallucinating and excel at extracting information and summarizing text."
45
- },
46
- {
47
- "role": "user",
48
- "content": user_input
49
- }
50
- ])
51
  return response
52
 
53
  def suggestion_button(suggestion_text, teapot_ai):
 
36
  for i, (title, description, url) in enumerate(results, 1):
37
  documents.append(description.replace('<strong>','').replace('</strong>',''))
38
  print(documents)
39
+
40
+ context="\n".join(documents)
41
+
42
+ response = teapot_ai.query(
43
+ context=context,
44
+ query=user_input
45
+ )
46
 
47
+ # response = teapot_ai.chat([
48
+ # {
49
+ # "role": "system",
50
+ # "content": "You are Teapot, an open-source AI assistant optimized for running efficiently on low-end devices. You provide short, accurate responses without hallucinating and excel at extracting information and summarizing text."
51
+ # },
52
+ # {
53
+ # "role": "user",
54
+ # "content": user_input
55
+ # }
56
+ # ])
57
  return response
58
 
59
  def suggestion_button(suggestion_text, teapot_ai):