Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -265,16 +265,18 @@ def llm_worker():
|
|
265 |
tpm_bucket.wait_for_token(tokens=total_tokens)
|
266 |
|
267 |
# Prepare prompt
|
268 |
-
prompt =
|
269 |
You are an assistant that creates concise webpage summaries and assigns categories.
|
270 |
Provide summaries and categories for the following bookmarks:
|
271 |
|
272 |
'''
|
|
|
273 |
for idx, bookmark in enumerate(batch, 1):
|
274 |
prompt += f'Bookmark {idx}:\nURL: {bookmark["url"]}\nTitle: {bookmark["title"]}\n\n'
|
275 |
|
276 |
# Corrected f-string without backslashes
|
277 |
-
|
|
|
278 |
|
279 |
prompt += "Format your response as a JSON object where each key is the bookmark URL and the value is another JSON object containing 'summary' and 'category'.\n\n"
|
280 |
prompt += "Example:\n"
|
|
|
265 |
tpm_bucket.wait_for_token(tokens=total_tokens)
|
266 |
|
267 |
# Prepare prompt
|
268 |
+
prompt = '''
|
269 |
You are an assistant that creates concise webpage summaries and assigns categories.
|
270 |
Provide summaries and categories for the following bookmarks:
|
271 |
|
272 |
'''
|
273 |
+
|
274 |
for idx, bookmark in enumerate(batch, 1):
|
275 |
prompt += f'Bookmark {idx}:\nURL: {bookmark["url"]}\nTitle: {bookmark["title"]}\n\n'
|
276 |
|
277 |
# Corrected f-string without backslashes
|
278 |
+
categories_str = ', '.join([f'"{cat}"' for cat in CATEGORIES])
|
279 |
+
prompt += f'Categories:\n{categories_str}\n\n'
|
280 |
|
281 |
prompt += "Format your response as a JSON object where each key is the bookmark URL and the value is another JSON object containing 'summary' and 'category'.\n\n"
|
282 |
prompt += "Example:\n"
|