Skip to content

Commit

Permalink
update template for seperate tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzaizai2k committed Jan 22, 2024
1 parent 7d9a054 commit 0a3bfcb
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 36 deletions.
39 changes: 31 additions & 8 deletions config/seperate_task_template.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
Do not write irrelevant information. Summary, fix and Break down text into tasks. return just a json file that has these information: title, importance, dueDateTime, body like this.
Remember that I prefer working and learning to entertaining. I usually work from 8 AM to 5 PM, Then go home and entertain after 6 PM
{'title': task,
'important': Bool (True is important),
'dueDateTime': 'YYYY-MM-DD:HH:mm:ss',
Do not write irrelevant information. Summary, fix and Break down text into future tasks. return just a json file that has these information: title, importance, dueDateTime.

{
'title': task name with date time,
'important': Bool (True is important),
'dueDateTime': 'YYYY-MM-DD:HH:mm:ss',
}

Remember that I am a Vietnamese person, I prefer working and learning to entertaining. I usually work as a machine learning engineer and do most of my tasks from 8 AM to 5 PM,
Then go home and do other things like work out and read books after 6 PM. I usually take classes for master degree on Monday, Wednesday, Friday and Saturday from 6 PM to 8:30PM.
I'd like to do my homework on Sunday. I usually go to bed before 11 PM

for example:
Input: "remind me that I have to check out a Gemini bro and I have to go to shopping at the market at 3 PM. I have to play badminton tomorrow at 8 o'clock"
Input: "remind me that I have to check out a Gemini bro and I have to go to shopping at the market at 3 PM.
I have to play badminton tomorrow at 8 o'clock. Uhm I need to buy clothes at 7, sorry, at 10 o clock.
Ah Learn LLM and RAG tomorrow and working on math in the next 2 days"
Output:
[
{
'title': "Check out a Gemini bro",
'important': False,
'important': True,
'dueDateTime': None
},
{
Expand All @@ -20,8 +28,23 @@ Output:
},
{
'title': "Play badminton tomorrow at 8 o clock",
'important': False,
'dueDateTime': "2024-01-11:08:00:00"
}
{
'title': "Buy clothes at 10 o clock",
'important': False,
'dueDateTime': "2024-01-10:10:00:00"
}
{
'title': "Learn LLM and RAG tomorrow",
'important': True,
'dueDateTime': "2024-01-11:00:00:00"
}
{
'title': "Working on math in the next 2 days",
'important': True,
'dueDateTime': "2024-01-10:08:00:00"
'dueDateTime': "2024-01-12:00:00:00"
}
]

63 changes: 36 additions & 27 deletions notebook/langchain_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -122,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -135,12 +135,12 @@
"metadata": {},
"outputs": [],
"source": [
"text = 'Hi remind me take my laptop in Hoa house after lunch, I have to call friends, ah no my parents at 10 o clock tomorrow. If done, go to the store at 4PM'"
"text = 'Hi remind me take my laptop in Hoa house after lunch, I have to call friends, ah no my parents at 10 o clock tomorrow. If done, go to the store at 4PM. Uhm I want to learn math tomorrow'"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -158,25 +158,28 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'title': 'Take laptop in Hoa house after lunch',\n",
" 'important': True,\n",
"[{'title': 'Take laptop to Hoa house after lunch',\n",
" 'important': False,\n",
" 'dueDateTime': None},\n",
" {'title': 'Call friends', 'important': False, 'dueDateTime': None},\n",
" {'title': 'Call parents at 10 o clock tomorrow',\n",
" 'important': True,\n",
" 'dueDateTime': '2024-01-19:10:00:00'},\n",
" {'title': 'Go to the store at 4PM',\n",
" 'important': False,\n",
" 'dueDateTime': '2024-01-18:16:00:00'}]"
" 'dueDateTime': '2024-01-23:10:00:00'},\n",
" {'title': 'Go to the store at 4 PM',\n",
" 'important': True,\n",
" 'dueDateTime': '2024-01-23:16:00:00'},\n",
" {'title': 'Learn math tomorrow',\n",
" 'important': True,\n",
" 'dueDateTime': '2024-01-23:08:00:00'}]"
]
},
"execution_count": 13,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -396,12 +399,13 @@
" raise\n",
"\n",
" def create_task(self,\n",
" task_name: str,\n",
" list_name: str = None,\n",
" list_id: str = None,\n",
" importance:bool = False,\n",
" dueDateTime: datetime = None,\n",
" body=None,\n",
" task_name: str,\n",
" list_name: str = None,\n",
" list_id: str = None,\n",
" importance:bool = False,\n",
" dueDateTime: datetime = None,\n",
" body=None,\n",
" reminder_datetime: datetime = None,\n",
" ):\n",
" assert (list_name is not None) or (\n",
" list_id is not None\n",
Expand All @@ -410,26 +414,31 @@
" # For compatibility with cli\n",
" if list_id is None:\n",
" list_id = self.get_list_id_by_name(list_name)\n",
" \n",
" if dueDateTime is not None:\n",
" dueDateTime = datetime.strptime(dueDateTime, '%Y-%m-%d:%H:%M:%S')\n",
" # Check if the time part is '00:00'\n",
" if dueDateTime.strftime('%H:%M') == '00:00':\n",
" # Replace it with the current datetime\n",
" dueDateTime = datetime.now()\n",
" \n",
" if reminder_datetime is None:\n",
" reminder_datetime = dueDateTime\n",
" \n",
" importance = 'high' if importance else 'normal'\n",
"\n",
" if body is None:\n",
" body ={\"content\": task_name,\n",
" \"contentType\": \"text\"\n",
" }\n",
" \n",
" if dueDateTime is not None:\n",
" dueDateTime = datetime.strptime(dueDateTime, '%Y-%m-%d:%H:%M:%S')\n",
" \n",
" if importance == False:\n",
" importance = 'normal'\n",
" else:\n",
" importance = 'high'\n",
" \n",
"\n",
" endpoint = f\"{BASE_URL}/{list_id}/tasks\"\n",
" request_body = {\n",
" \"title\": task_name,\n",
" \"body\":body,\n",
" \"importance\": importance,\n",
" \"dueDateTime\": datetime_to_api_timestamp(dueDateTime),\n",
" \"reminderDateTime\": datetime_to_api_timestamp(reminder_datetime),\n",
" }\n",
" session = get_oauth_session()\n",
" response = session.post(endpoint, json=request_body)\n",
Expand Down
7 changes: 7 additions & 0 deletions src/Microsofttodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,13 @@ def create_task(self,

if dueDateTime is not None:
dueDateTime = datetime.strptime(dueDateTime, '%Y-%m-%d:%H:%M:%S')
# Check if the time part is '00:00'
if dueDateTime.strftime('%H:%M') == '00:00':
# Replace HH:MM with the current datetime HH:MM
dueDateTime = dueDateTime.replace(
hour=datetime.now().hour, minute=datetime.now().minute
)

if reminder_datetime is None:
reminder_datetime = dueDateTime

Expand Down
2 changes: 1 addition & 1 deletion src/stock_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def summarize_sound(message):

try:
text = speech_to_text.generate_speech_to_text()
print('voice', text)
print(f'Original voice:\n {text}')
bot.reply_to(message, f"Here's your note:\n {text}")
except Exception as e:
print('Error', e)
Expand Down

0 comments on commit 0a3bfcb

Please sign in to comment.