CoACT initialize (#292)

This commit is contained in:
Linxin Song
2025-07-30 19:35:20 -07:00
committed by GitHub
parent 862d704b8c
commit b968155757
228 changed files with 42386 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
# Copyright (c) 2023 - 2025, AG2ai, Inc., AG2ai open-source projects maintainers and core contributors
#
# SPDX-License-Identifier: Apache-2.0
from .time import TimeTool
__all__ = [
"TimeTool",
]

View File

@@ -0,0 +1,7 @@
# Copyright (c) 2023 - 2025, AG2ai, Inc., AG2ai open-source projects maintainers and core contributors
#
# SPDX-License-Identifier: Apache-2.0
from .time import TimeTool
__all__ = ["TimeTool"]

View File

@@ -0,0 +1,41 @@
# Copyright (c) 2023 - 2025, AG2ai, Inc., AG2ai open-source projects maintainers and core contributors
#
# SPDX-License-Identifier: Apache-2.0
from datetime import datetime
from typing import Annotated
from autogen.tools import Tool
from ....doc_utils import export_module
__all__ = ["TimeTool"]
@export_module("autogen.tools.contrib") # API Reference: autogen > tools > contrib > TimeAgent
class TimeTool(Tool):
"""Outputs the current date and time of the computer."""
def __init__(
self,
*,
date_time_format: str = "%Y-%m-%d %H:%M:%S", # This is a parameter that is unique to this tool
):
"""Get the date and time of the computer.
Args:
date_time_format (str, optional): The format of the date and time. Defaults to "%Y-%m-%d %H:%M:%S".
"""
self._date_time_format = date_time_format
async def get_date_and_time(
date_time_format: Annotated[str, "date/time Python format"] = self._date_time_format,
) -> str:
return datetime.now().strftime(date_time_format)
super().__init__(
name="date_time",
description="Get the current computer's date and time.",
func_or_tool=get_date_and_time,
)