Update app.py
Browse files
app.py
CHANGED
|
@@ -348,16 +348,6 @@ def google_search(term, num_results=5, lang="en", timeout=5, safe="active", ssl_
|
|
| 348 |
|
| 349 |
return all_results
|
| 350 |
|
| 351 |
-
def estimate_tokens(text):
|
| 352 |
-
# A more accurate estimation (still an estimate, but better than 1 token = 4 chars)
|
| 353 |
-
return len(text.split())
|
| 354 |
-
|
| 355 |
-
def truncate_text(text, max_tokens):
|
| 356 |
-
words = text.split()
|
| 357 |
-
if len(words) <= max_tokens:
|
| 358 |
-
return text
|
| 359 |
-
return ' '.join(words[:max_tokens])
|
| 360 |
-
|
| 361 |
def estimate_tokens(text):
|
| 362 |
return len(text.split())
|
| 363 |
|
|
|
|
| 348 |
|
| 349 |
return all_results
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
def estimate_tokens(text):
|
| 352 |
return len(text.split())
|
| 353 |
|