nat.tool.datetime_tools#

Classes#

CurrentTimeToolConfig

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

Functions#

_get_timezone_obj(→ zoneinfo.ZoneInfo | datetime.tzinfo)

current_datetime(_config, _builder)

Module Contents#

class CurrentTimeToolConfig(/, **data: Any)#

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”.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

_get_timezone_obj(
headers: starlette.datastructures.Headers | None,
) zoneinfo.ZoneInfo | datetime.tzinfo#
async current_datetime(
_config: CurrentTimeToolConfig,
_builder: nat.builder.builder.Builder,
)#