- Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathassistant_skills.py
31 lines (22 loc) · 953 Bytes
/
assistant_skills.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
importjson
importlogging
importuuid
importazure.functionsasfunc
fromtodo_managerimportCreateTodoManager, TodoItem
skills=func.Blueprint()
todo_manager=CreateTodoManager()
@skills.function_name("AddTodo")
@skills.assistant_skill_trigger(arg_name="taskDescription", function_description="Create a new todo task")
defadd_todo(taskDescription: str) ->None:
ifnottaskDescription:
raiseValueError("Task description cannot be empty")
logging.info(f"Adding todo: {taskDescription}")
todo_id=str(uuid.uuid4())[0:6]
todo_manager.add_todo(TodoItem(id=todo_id, task=taskDescription))
return
@skills.function_name("GetTodos")
@skills.assistant_skill_trigger(arg_name="inputIgnored", function_description="Fetch the list of previously created todo tasks")
defget_todos(inputIgnored: str) ->str:
logging.info("Fetching list of todos")
results=todo_manager.get_todos()
returnjson.dumps(results)