{"id":"chatcmpl-beb569d69b4b82b8","object":"chat.completion","created":1774196443,"model":"NousResearch\/Hermes-3-Llama-3.2-3B","choices":[{"index":0,"message":{"role":"assistant","content":"import argparse\nimport datetime\nimport json\nimport uuid\nfrom colorama import Fore, Style\n\nclass Task:\n    def __init__(self, title, description=None, completed=False, priority='medium', due_date=None):\n        self.id = self._generate_id()\n        self.title = title\n        self.description = description\n        self.completed = completed\n        self.priority = priority\n        self.due_date = due_date\n        self.created_at = datetime.now()\n\n    @staticmethod\n    def _generate_id():\n        return str(uuid.uuid4())\n\nclass TaskManager:\n    def __init__(self):\n        self.tasks = []\n\n    def add_task(self, title, description=None, due_date=None):\n        task = Task(title, description, due_date)\n        self.tasks.append(task)\n\n    def list_tasks(self, show_completed=False):\n        if show_completed:\n            tasks = self.tasks\n        else:\n            tasks = [task for task in self.tasks if not task.completed]\n        for task in tasks:\n            color = Fore.YELLOW if task.priority == 'medium' else Fore.GREEN if task.priority == 'low' else Fore.RED\n            print(f\"{color}ID: {task.id}, Title: {task.title}, Description: {task.description}, Completed: {task.completed}, Priority: {task.priority}{Style.RESET_ALL}\")\n\n    def complete_task(self, task_id):\n        for task in self.tasks:\n            if task.id == task_id:\n                task.completed = True\n                break\n\n    def delete_task(self, task_id):\n        for task in self.tasks:\n            if task.id == task_id:\n                self.tasks.remove(task)\n                break\n\n    def save_to_file(self, filepath):\n        with open(filepath, 'w') as f:\n            json.dump(self.tasks, f)\n\n    @staticmethod\n    def load_from_file(filepath):\n        with open(filepath, 'r') as f:\n            tasks = json.load(f)\n        task_manager = TaskManager()\n        task_manager.tasks = tasks\n        return task_manager\n\n    def is_overdue(self, task_id):\n        for task in self.tasks:\n            if task.id == task_id:\n                return task.due_date < datetime.now().date()\n\ndef main():\n    parser = argparse.ArgumentParser(description='Task Manager CLI')\n    subparsers = parser.add_subparsers(dest='command')\n\n    add_parser = subparsers.add_parser('add', help='Add a new task')\n    add_parser.add_argument('title', help='Task title')\n    add_parser.add_argument('-d', '--description', help='Task description', default=None)\n    add_parser.add_argument('--due', help='Due date (YYYY-MM-DD)', default=None)\n\n    list_parser = subparsers.add_parser('list', help='List all tasks')\n    list_parser.add_argument('--all', action='store_true', help='List all tasks including completed')\n    list_parser.add_argument('--sort', choices=['priority', 'date'], help='Sort tasks by priority or created_at')\n\n    complete_parser = subparsers.add_parser('complete', help='Mark a task as done')\n    complete_parser.add_argument('id', help='Task ID')\n\n    delete_parser = subparsers.add_parser('delete', help='Delete a task')\n    delete_parser.add_argument('id', help='Task ID')\n\n    overdue_parser = subparsers.add_parser('overdue', help='Show overdue tasks')\n    overdue_parser.add_argument('--all', action='store_true', help='Show all overdue tasks')\n\n    args = parser.parse_args()\n\n    task_manager = TaskManager()\n\n    if args.command == 'add':\n        task_manager.add_task(args.title, args.description, args.due)\n    elif args.command == 'list':\n        task_manager.list_tasks(args.all)\n        if args.sort:\n            task_manager.list_tasks(show_completed=False, sort=args.sort)\n    elif args.command == 'complete':\n        task_manager.complete_task(args.id)\n    elif args.command == 'delete':\n        task_manager.delete_task(args.id)\n    elif args.command == 'load':\n        task_manager = TaskManager.load_from_file(args.filepath)\n    elif args.command == 'overdue':\n        if args.all:\n            overdue = [task for task in task_manager.tasks if task.completed]\n        else:\n            overdue = [task for task in task_manager.tasks if task.completed and task.due_date < datetime.now().date()]\n        for task in overdue:\n            print(f\"[OVERDUE] ID: {task.id}, Title: {task.title}\")\n\nif __name__ == '__main__':\n    main()","refusal":null,"annotations":null,"audio":null,"function_call":null,"tool_calls":[],"reasoning":null},"logprobs":null,"finish_reason":"stop","token_ids":null}],"service_tier":null,"system_fingerprint":null,"usage":{"prompt_tokens":2407,"total_tokens":3336,"completion_tokens":929,"prompt_tokens_details":null},"prompt_token_ids":null,"kv_transfer_params":null}
