add time
Browse files- llm_interface.py +11 -0
llm_interface.py
CHANGED
@@ -4,6 +4,7 @@ LLM Interface for the AAC app using Simon Willison's LLM library.
|
|
4 |
|
5 |
import subprocess
|
6 |
import time
|
|
|
7 |
from typing import List, Optional, Dict, Any
|
8 |
|
9 |
|
@@ -140,6 +141,12 @@ class LLMInterface:
|
|
140 |
}
|
141 |
mood_description = mood_descriptions.get(mood, mood_descriptions[3])
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
# Build enhanced prompt
|
144 |
prompt = f"""I am Will, a 38-year-old with MND (Motor Neuron Disease) from Manchester.
|
145 |
I am talking to {name}, who is my {role}.
|
@@ -147,6 +154,10 @@ About {name}: {context}
|
|
147 |
We typically talk about: {', '.join(topics)}
|
148 |
We communicate {frequency}.
|
149 |
|
|
|
|
|
|
|
|
|
150 |
My current mood: {mood_description}
|
151 |
"""
|
152 |
|
|
|
4 |
|
5 |
import subprocess
|
6 |
import time
|
7 |
+
import datetime
|
8 |
from typing import List, Optional, Dict, Any
|
9 |
|
10 |
|
|
|
141 |
}
|
142 |
mood_description = mood_descriptions.get(mood, mood_descriptions[3])
|
143 |
|
144 |
+
# Get current date and time
|
145 |
+
current_datetime = datetime.datetime.now()
|
146 |
+
current_time = current_datetime.strftime("%I:%M %p") # e.g., 02:30 PM
|
147 |
+
current_day = current_datetime.strftime("%A") # e.g., Monday
|
148 |
+
current_date = current_datetime.strftime("%B %d, %Y") # e.g., January 01, 2023
|
149 |
+
|
150 |
# Build enhanced prompt
|
151 |
prompt = f"""I am Will, a 38-year-old with MND (Motor Neuron Disease) from Manchester.
|
152 |
I am talking to {name}, who is my {role}.
|
|
|
154 |
We typically talk about: {', '.join(topics)}
|
155 |
We communicate {frequency}.
|
156 |
|
157 |
+
Current time: {current_time}
|
158 |
+
Current day: {current_day}
|
159 |
+
Current date: {current_date}
|
160 |
+
|
161 |
My current mood: {mood_description}
|
162 |
"""
|
163 |
|