nat.tool.datetime_tools#

Classes#

CurrentTimeToolConfig

Simple tool which returns the current date and time in human readable format with timezone information. By default,

CurrentTimeZoneToolConfig

Simple tool which returns the name of the current timezone.

Functions#

_get_timezone_from_headers(→ zoneinfo.ZoneInfo | None)

_get_system_timezone(→ zoneinfo.ZoneInfo)

_get_timezone_obj(→ zoneinfo.ZoneInfo)

current_datetime(_config, _builder)

current_timezone(_config, _builder)

Module Contents#

class CurrentTimeToolConfig#

Bases: nat.data_models.function.FunctionBaseConfig

Simple tool which returns the current date and time in human readable format with timezone information. By default, the timezone is in Etc/UTC. If the user provides a timezone in the header, we will use it. Timezone will be provided in IANA zone name format. For example, “America/New_York” or “Etc/UTC”.

class CurrentTimeZoneToolConfig#

Bases: nat.data_models.function.FunctionBaseConfig

Simple tool which returns the name of the current timezone.

_get_timezone_from_headers(
headers: starlette.datastructures.Headers | None,
) zoneinfo.ZoneInfo | None#
_get_system_timezone(
fallback_tz: str = 'Etc/UTC',
) zoneinfo.ZoneInfo#
_get_timezone_obj(
headers: starlette.datastructures.Headers | None,
) zoneinfo.ZoneInfo#
async current_datetime(
_config: CurrentTimeToolConfig,
_builder: nat.builder.builder.Builder,
)#
async current_timezone(
_config: CurrentTimeZoneToolConfig,
_builder: nat.builder.builder.Builder,
)#