82 lines
2.1 KiB
Python
82 lines
2.1 KiB
Python
import random
|
|
from langchain_core.tools import tool
|
|
|
|
|
|
@tool
|
|
def print_poem(poem_type: str = "random") -> str:
|
|
"""
|
|
Print a beautiful poem for the user.
|
|
|
|
Args:
|
|
poem_type: Type of poem to print. Options: "nature", "tech", "motivational", "random"
|
|
|
|
Returns:
|
|
A beautiful poem as a string
|
|
"""
|
|
|
|
poems = {
|
|
"nature": """
|
|
🌿 Nature's Symphony 🌿
|
|
|
|
In the whisper of the wind through ancient trees,
|
|
Where sunlight dances on the morning breeze,
|
|
The earth awakens with a gentle song,
|
|
A melody that's carried all along.
|
|
|
|
Rivers flow with stories untold,
|
|
Mountains stand majestic and bold,
|
|
In nature's embrace, we find our peace,
|
|
Where all our worries and troubles cease.
|
|
""",
|
|
|
|
"tech": """
|
|
💻 Digital Dreams 💻
|
|
|
|
In lines of code, our dreams take flight,
|
|
Binary stars illuminate the night,
|
|
Algorithms dance in silicon halls,
|
|
While innovation answers progress calls.
|
|
|
|
From circuits small to networks vast,
|
|
We build the future, learn from the past,
|
|
In every byte and every bit,
|
|
Human creativity and logic fit.
|
|
""",
|
|
|
|
"motivational": """
|
|
⭐ Rise and Shine ⭐
|
|
|
|
Every dawn brings a chance anew,
|
|
To chase the dreams that call to you,
|
|
Though mountains high may block your way,
|
|
Your spirit grows stronger every day.
|
|
|
|
The path is long, the journey tough,
|
|
But you, my friend, are strong enough,
|
|
With courage as your faithful guide,
|
|
Success will walk right by your side.
|
|
""",
|
|
|
|
"friendship": """
|
|
🤝 Bonds of Friendship 🤝
|
|
|
|
In laughter shared and tears that fall,
|
|
True friendship conquers over all,
|
|
Through seasons change and years that pass,
|
|
These precious bonds forever last.
|
|
|
|
A friend's warm smile, a helping hand,
|
|
Together strong, united we stand,
|
|
In friendship's light, we find our way,
|
|
Brightening each and every day.
|
|
"""
|
|
}
|
|
|
|
# If random or invalid type, pick a random poem
|
|
if poem_type == "random" or poem_type not in poems:
|
|
poem_type = random.choice(list(poems.keys()))
|
|
|
|
selected_poem = poems[poem_type]
|
|
|
|
return f"Here's a {poem_type} poem for you:\n{selected_poem}"
|