Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,11 +31,13 @@ def brave_search(query, count=3):
|
|
| 31 |
# Function to handle the chat with TeapotAI
|
| 32 |
def handle_chat(user_input, teapot_ai):
|
| 33 |
results = brave_search(user_input)
|
| 34 |
-
|
| 35 |
-
for i, (title, description, url) in enumerate(results, 1):
|
| 36 |
-
print(f"{i}. {title}\n {description.replace('<strong>','').replace('</strong>','')}\n {url}\n")
|
| 37 |
-
st.write(f"{i}. {title}\n {description.replace('<strong>','').replace('</strong>','')}\n {url}\n")
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
response = teapot_ai.chat([
|
| 40 |
{
|
| 41 |
"role": "system",
|
|
|
|
| 31 |
# Function to handle the chat with TeapotAI
|
| 32 |
def handle_chat(user_input, teapot_ai):
|
| 33 |
results = brave_search(user_input)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
documents = []
|
| 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",
|