Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,17 @@ def brave_search(query, count=3):
|
|
| 28 |
print(f"Error: {response.status_code}, {response.text}")
|
| 29 |
return []
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Function to handle the chat with TeapotAI
|
| 33 |
-
@traceable
|
| 34 |
def handle_chat(user_input, teapot_ai):
|
| 35 |
results = brave_search(user_input)
|
| 36 |
|
|
@@ -41,10 +49,7 @@ def handle_chat(user_input, teapot_ai):
|
|
| 41 |
|
| 42 |
context="\n".join(documents)
|
| 43 |
|
| 44 |
-
response =
|
| 45 |
-
context=context,
|
| 46 |
-
query=user_input
|
| 47 |
-
)
|
| 48 |
|
| 49 |
# response = teapot_ai.chat([
|
| 50 |
# {
|
|
|
|
| 28 |
print(f"Error: {response.status_code}, {response.text}")
|
| 29 |
return []
|
| 30 |
|
| 31 |
+
@traceable
|
| 32 |
+
def query_teapot(context, query):
|
| 33 |
+
response = teapot_ai.query(
|
| 34 |
+
context=context,
|
| 35 |
+
query=user_input
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
return response
|
| 39 |
+
|
| 40 |
|
| 41 |
# Function to handle the chat with TeapotAI
|
|
|
|
| 42 |
def handle_chat(user_input, teapot_ai):
|
| 43 |
results = brave_search(user_input)
|
| 44 |
|
|
|
|
| 49 |
|
| 50 |
context="\n".join(documents)
|
| 51 |
|
| 52 |
+
response = query_teapot(context, query)
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# response = teapot_ai.chat([
|
| 55 |
# {
|