Skip to content

neurotrace.core.tools.system

neurotrace.core.tools.system

get_current_datetime(_='')

Use this tool to get the current date and time in a human-readable format. :param _: :return:

Source code in neurotrace/core/tools/system.py
def get_current_datetime(_: str = "") -> str:
    """
    Use this tool to get the current date and time in a human-readable format.
    :param _:
    :return:
    """
    return datetime.now().strftime("%A, %B %d, %Y at %I:%M %p")

get_current_location(_='')

Use this tool to get the current location based on the public IP address. :param _: :return:

Source code in neurotrace/core/tools/system.py
def get_current_location(_: str = "") -> str:
    """
    Use this tool to get the current location based on the public IP address.
    :param _:
    :return:
    """
    try:
        ip = requests.get("https://api.ipify.org").text
        response = requests.get(f"https://ipinfo.io/{ip}/json").json()
        city = response.get("city", "")
        region = response.get("region", "")
        country = response.get("country", "")
        return f"{city}, {region}, {country}".strip(", ")
    except Exception:
        return "Unable to determine location."

get_day_of_week(_='')

Use this tool to get the current day of the week. :param _: :return:

Source code in neurotrace/core/tools/system.py
def get_day_of_week(_: str = "") -> str:
    """
    Use this tool to get the current day of the week.
    :param _:
    :return:
    """
    return datetime.now().strftime("%A")

get_device_info(_='')

Use this tool to get basic information about the current device. :param _: :return:

Source code in neurotrace/core/tools/system.py
def get_device_info(_: str = "") -> str:
    """
    Use this tool to get basic information about the current device.
    :param _:
    :return:
    """
    return (
        f"System: {platform.system()}\n"
        f"Release: {platform.release()}\n"
        f"Processor: {platform.processor()}\n"
        f"Machine: {platform.machine()}"
    )

get_ip_address(_='')

Use this tool to get the current public IP address. :param _: :return:

Source code in neurotrace/core/tools/system.py
def get_ip_address(_: str = "") -> str:
    """
    Use this tool to get the current public IP address.
    :param _:
    :return:
    """
    try:
        return requests.get("https://api.ipify.org").text
    except Exception:
        return "Unable to fetch IP address."