cuery.tool#
Base classes for tools with well-defined input and output interfaces.
Tools are essentially wrappers of Tasks. But they use pydantic models to also define the input interface. The inputs are then used to customize a task’s prompt, response model and input context. They’re only really useful if a task’s prompt or response are configurable, e.g. a classification task with configurable number of classes.
Classes#
Base class for all tools. |
Module Contents#
- class cuery.tool.Tool(/, **data)#
Bases:
cuery.utils.Configurable,abc.ABCBase class for all tools.
Subclasses need to implement prompt and response models; either statically as ClassVars, or dynamically as (executable) instance properties.
- Parameters:
data (Any)
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model: str = None#
The LLM provider and model to use.
- property response_model: cuery.response.ResponseClass#
- Abstractmethod:
- Return type:
cuery.response.ResponseClass
Defines the response model for this tool (ClassVar or property).
- property prompt: cuery.prompt.Prompt#
- Abstractmethod:
- Return type:
Defines the prompt for this tool (ClassVar or property).
- property task: cuery.task.Task#
Create a Task instance for this tool.
- Return type:
- property context: cuery.context.AnyContext | None#
- Return type:
cuery.context.AnyContext | None
- async __call__(**kwargs)#
- Return type: