Skip to content

Commit

Permalink
modified: get_current_date_time tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunprakaash authored May 25, 2024
1 parent ecceb87 commit 577fa1a
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/sayvai_tools/tools/date/tool.py
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")

0 comments on commit 577fa1a

Please sign in to comment.