Skip to content

Tool

datapizza.tools.Tool

Class that wraps a function while preserving its behavior and adding attributes.

__init__

__init__(
    func=None,
    name=None,
    description=None,
    end=False,
    properties=None,
    required=None,
    strict=False,
)

Parameters:

Name Type Description Default
func Callable | None

The function to wrap.

None
name str | None

The name of the tool.

None
description str | None

The description of the tool.

None
end bool

Whether the tool ends a chain of operations.

False
properties dict[str, dict[str, Any]] | None

The properties of the tool.

None
required list[str] | None

The required parameters of the tool.

None
strict bool

Whether the tool is strict.

False

to_dict

to_dict()

Convert the tool to a dictionary for JSON serialization.