Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def log_time(func):
|
|
38 |
API_KEY = os.environ.get("brave_api_key")
|
39 |
|
40 |
@log_time
|
41 |
-
async def brave_search(query, count=
|
42 |
url = "https://api.search.brave.com/res/v1/web/search"
|
43 |
headers = {"Accept": "application/json", "X-Subscription-Token": API_KEY}
|
44 |
params = {"q": query, "count": count}
|
@@ -87,7 +87,7 @@ async def handle_chat(user_input):
|
|
87 |
documents = [desc.replace('<strong>', '').replace('</strong>', '') for _, desc, _ in results]
|
88 |
|
89 |
context = "\n".join(documents)
|
90 |
-
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.
|
91 |
generation_start_time = time.time()
|
92 |
response = await query_teapot(prompt, context, user_input)
|
93 |
generation_end_time = time.time()
|
|
|
38 |
API_KEY = os.environ.get("brave_api_key")
|
39 |
|
40 |
@log_time
|
41 |
+
async def brave_search(query, count=1):
|
42 |
url = "https://api.search.brave.com/res/v1/web/search"
|
43 |
headers = {"Accept": "application/json", "X-Subscription-Token": API_KEY}
|
44 |
params = {"q": query, "count": count}
|
|
|
87 |
documents = [desc.replace('<strong>', '').replace('</strong>', '') for _, desc, _ in results]
|
88 |
|
89 |
context = "\n".join(documents)
|
90 |
+
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."""
|
91 |
generation_start_time = time.time()
|
92 |
response = await query_teapot(prompt, context, user_input)
|
93 |
generation_end_time = time.time()
|