-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: get_current_date_time tool
- Loading branch information
1 parent
ecceb87
commit 577fa1a
Showing
1 changed file
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
import datetime | ||
from datetime import datetime | ||
from typing import Optional | ||
|
||
from langchain.tools import BaseTool | ||
|
||
from sayvai_tools.utils.exception import SayvaiToolsError | ||
from langchain_core.callbacks import CallbackManagerForToolRun | ||
|
||
|
||
class GetDate(BaseTool): | ||
"""Get the current date and time.""" | ||
|
||
name = "GetDate" | ||
description = "Get the current date and time." | ||
name: str = "get_current_date_time" | ||
description: str = "Gets the current date and time." | ||
|
||
@classmethod | ||
def create(cls) -> "GetDate": | ||
return cls() | ||
|
||
def _run(self, tool_input: str | None = None) -> str: | ||
"""Use the tool.""" | ||
current_time = datetime.datetime.now() | ||
def _run(self, | ||
run_manager: Optional[CallbackManagerForToolRun] = None | ||
) -> str: | ||
current_time = datetime.now() | ||
return str(current_time) | ||
|
||
async def _arun(self) -> str: | ||
"""Use the tool asynchronously.""" | ||
raise SayvaiToolsError("Not NotImplemented Error") |