-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.py
More file actions
33 lines (29 loc) · 954 Bytes
/
Copy pathapi.py
File metadata and controls
33 lines (29 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import enum
from typing import Annotated
from livekit.agents import llm
import logging
logger = logging.getLogger("temperature-control")
logger.setLevel(logging.INFO)
class Zone(enum.Enum):
LIVING_ROOM = "living_room"
BEDROOM = "bedroom"
KITCHEN = "kitchen"
BATHROOM = "bathroom"
OFFICE = "office"
class AssistantFnc(llm.FunctionContext):
def __init__(self) -> None:
super().__init__()
self.temperature = {
Zone.LIVING_ROOM: 22,
Zone.BEDROOM: 20,
Zone.KITCHEN: 24,
Zone.BATHROOM: 23,
Zone.OFFICE: 21
}
@llm.ai_callable(description="get the temperature in a specific room")
def get_temperature(
self, zone:Annotated[Zone, llm.TypeInfo(description="The specific zone")]
):
logger.info("get temp - zone s%", zone)
temp = self._temperature[Zone(zone)]
return f"The temprature in the {zone} is {temp}C"