KNOWLEDGE_BASE = [
{
"id": "kb-01",
"title": "Pairing the thermostat with the mobile app",
"content": "To pair the thermostat, open the mobile app, tap Add Device, and hold the thermostat's center button for five seconds until the display shows a pairing code. Enter the code in the app. Pairing requires Bluetooth and a 2.4 GHz Wi-Fi network.",
},
{
"id": "kb-02",
"title": "Blank screen after installation",
"content": "A blank screen usually means the thermostat isn't receiving power. Confirm the C-wire (common wire) is connected at both the thermostat base and the HVAC control board. If your system has no C-wire, install the included power adapter.",
},
{
"id": "kb-03",
"title": "Wi-Fi disconnects and offline status",
"content": "If the thermostat shows as offline, confirm your router broadcasts a 2.4 GHz network; the thermostat doesn't support 5 GHz-only networks. Move the router within 10 meters if the signal indicator shows one bar, then restart the thermostat from Settings > Restart.",
},
{
"id": "kb-04",
"title": "Battery and power adapter",
"content": "The thermostat has a backup battery that keeps settings for 48 hours during a power outage. The battery charges from the C-wire or power adapter. A battery icon on the display means the thermostat is running on backup power and will shut down soon.",
},
{
"id": "kb-05",
"title": "Creating temperature schedules",
"content": "Create schedules in the app under Schedule > New. Each schedule supports up to eight temperature changes per day. Schedules sync to the thermostat within one minute. Manual temperature changes override the schedule until the next scheduled change.",
},
{
"id": "kb-06",
"title": "Temperature reading seems wrong",
"content": "If the displayed temperature differs from the room temperature, check that the thermostat isn't in direct sunlight or near a heat source. You can apply a calibration offset of up to ±5 degrees in Settings > Temperature Offset.",
},
{
"id": "kb-07",
"title": "Warranty and returns",
"content": "The thermostat includes a two-year limited warranty covering manufacturing defects. Returns are accepted within 60 days of purchase with proof of purchase. Warranty claims are handled through the app under Support > Start a Claim.",
},
{
"id": "kb-08",
"title": "Updating firmware",
"content": "Firmware updates install automatically overnight when the thermostat is connected to Wi-Fi. To update manually, go to Settings > About > Check for Updates. The display shows a progress bar during updates; don't cut power while an update is in progress.",
},
{
"id": "kb-09",
"title": "Vacation mode",
"content": "Vacation mode holds an energy-saving temperature while you're away and resumes your normal schedule when you return. Enable it in the app under Modes > Vacation and set a start and end date. Geofencing can end vacation mode automatically when your phone arrives home.",
},
{
"id": "kb-10",
"title": "Compatible HVAC systems",
"content": "The thermostat supports most 24V heating and cooling systems, including gas, oil, electric, forced air, and heat pumps with auxiliary heat. It doesn't support high-voltage (120/240V) baseboard heaters. Use the compatibility checker in the app before installing.",
},
]
def search_kb(keywords: list[str]) -> list[dict]:
"""Return knowledge base articles that match any of the given keywords."""
results = []
for article in KNOWLEDGE_BASE:
text = f"{article['title']} {article['content']}".lower()
if any(keyword.lower() in text for keyword in keywords):
results.append(article)
return results
SEARCH_TOOL = {
"type": "function",
"function": {
"name": "search_kb",
"description": "Search the product knowledge base for articles matching any of the given keywords.",
"parameters": {
"type": "object",
"properties": {
"keywords": {
"type": "array",
"items": {"type": "string"},
"description": "Keywords to search for.",
}
},
"required": ["keywords"],
},
},
}