Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,28 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 32 |
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
@@ -55,7 +76,8 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer],
|
|
|
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 32 |
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
+
@tool
|
| 36 |
+
def generate_keywords(topic: str, num_keywords: int) -> str:
|
| 37 |
+
"""A tool that generates relevant keywords for a given topic
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
topic: The main topic or subject area to generate keywords for
|
| 41 |
+
num_keywords: Number of keywords to generate (1-20)
|
| 42 |
+
"""
|
| 43 |
+
# Common keyword patterns and modifiers
|
| 44 |
+
modifiers = [
|
| 45 |
+
"как", "почему", "что такое", "топ", "лучший",
|
| 46 |
+
"обзор", "руководство", "советы", "примеры",
|
| 47 |
+
"методы", "способы", "виды", "типы"
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
suffixes = [
|
| 51 |
+
"для начинающих", "пошагово", "с нуля",
|
| 52 |
+
"быстро", "эффективно", "просто",
|
| 53 |
+
"в 2025 году", "онлайн", "на практике"
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
import random
|
| 57 |
|
| 58 |
final_answer = FinalAnswerTool()
|
| 59 |
|
|
|
|
| 76 |
|
| 77 |
agent = CodeAgent(
|
| 78 |
model=model,
|
| 79 |
+
tools=[final_answer],
|
| 80 |
+
[generate_keywords],## add your tools here (don't remove final answer)
|
| 81 |
max_steps=6,
|
| 82 |
verbosity_level=1,
|
| 83 |
grammar=None,
|