构建mars_toolkit,删除tools_for_ms

This commit is contained in:
lzy
2025-04-02 12:53:50 +08:00
parent 603304e10f
commit a77c2cd377
73 changed files with 1884 additions and 896 deletions

View File

@@ -0,0 +1,29 @@
"""
General Tools Module
This module provides basic utility functions that are not specific to materials science.
"""
import asyncio
from datetime import datetime
import pytz
from typing import Annotated
from mars_toolkit.core.llm_tools import llm_tool
@llm_tool(name="get_current_time", description="Get current date and time in specified timezone")
async def get_current_time(timezone: str = "UTC") -> str:
"""Returns the current date and time in the specified timezone.
Args:
timezone: Timezone name (e.g., UTC, Asia/Shanghai, America/New_York)
Returns:
Formatted date and time string
"""
try:
tz = pytz.timezone(timezone)
current_time = datetime.now(tz)
return f"The current {timezone} time is: {current_time.strftime('%Y-%m-%d %H:%M:%S %Z')}"
except pytz.exceptions.UnknownTimeZoneError:
return f"Unknown timezone: {timezone}. Please use a valid timezone such as 'UTC', 'Asia/Shanghai', etc."