-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathell-alarm.py
52 lines (35 loc) · 1.36 KB
/
ell-alarm.py
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
34
35
36
37
38
39
40
41
42
43
# An alarm clock with Ell.
# work in progress!
import os
from datetime import datetime
import time
import ell
from openai import OpenAI
MODEL = "llama3.1:8b"
client = OpenAI(
base_url = "http://localhost:11434/v1",
api_key = "ollama",
)
ell.config.verbose = True
ell.config.register_model(MODEL, client)
# Function to get just the current time
from datetime import datetime
def get_time_only():
now = datetime.now()
# Format: It's now 2:05 PM
formatted_time = now.strftime("It's now %I:%M:%S %p")
return formatted_time
@ell.simple(model=MODEL, client=client)
def ell_alarm(alarm_time:str, alarm_action):
"""You are Ell_alarm, an alarm clock. You keep track of user alarms and trigger actions. You are given the current time. When the user alarm time equals or is greater than the current time, you do what the user action requested. Here is example of how user can set an alarm. Example: Ell_alarm: 7:25 remind me to drink water. Response:Its time to drink water mate!"""
s = get_time_only() + "\n"
s += f"Ell_alarm: {alarm_time} {alarm_action}"
return s
if __name__ == "__main__":
while True:
callback = ell_alarm ("08:11:50 AM","finish coding Ell_adventure #8!")
# for testing every 10 seconds.
time.sleep(10)
# more useful to trigger every minute
#time.sleep(60)
print (callback)