This step-by-step guide will help you create a weather lookup skill.
1. Set Up Your Environment
pip install cllova-sdk
mkdir weather_skill && cd weather_skill
2. Create the Skill Class
from cllova.sdk import Skill, intent
import requests
class WeatherSkill(Skill):
def initialize(self):
self.register_intent("get_weather", self.handle_weather)
@intent("get_weather")
def handle_weather(self, location):
api_key = "YOUR_API_KEY"
url = f"https://api.weather.com/v1/{location}"
response = requests.get(url).json()
return {
"response": f"Weather in {location}: {response['temp']}°C",
"ui": {"type": "weather_card", "data": response}
}
3. Deploy to Your Device
cllova skills pack .
cllova skills install weather_skill.zip