Skip to main content

Functions

FUNC uses_tool

uses_tool(tool_name: str | Callable, check_only = False)
Forces the model to call a given tool. Args:
  • tool_name: The tool that must be called; this can be either the name of the tool or the Callable for the tool.
  • check_only: Propagates to the Requirement.
Use tool_choice if the OpenAI tool_choice model option is supported by your model and inference engine.

FUNC tool_arg_validator

tool_arg_validator(description: str, tool_name: str | Callable | None, arg_name: str, validation_fn: Callable, check_only: bool = False) -> Requirement
A requirement that passes only if validation_fn returns a True value for the value of the arg_name argument to tool_name. If tool_name is not specified, then this requirement is enforced for every tool that Args:
  • description: The Requirement description.
  • tool_name: The (optional) tool name for .
  • arg_name: The argument to check.
  • validation_fn: A validation function for validating the value of the arg_name argument.
  • check_only: propagates the check_only flag to the requirement.