huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
133.29k stars 26.62k forks source link

Boolean as tool input #34056

Open paulblgr opened 3 days ago

paulblgr commented 3 days ago

Feature request

It would be great if boolean was authorized as input to a Tool

Motivation

I am willing to use my own tools with transformers CodeAgent ; using the method tool I have a proper function func with typing and doc-strings as required. One of the input of the function is a bool. When I try to run tool(func) I get: Exception: Input 'perte_de_salaire': type 'boolean' is not an authorized value, should be one of ['string', 'integer', 'number', 'image', 'audio', 'any'].

The Exception is rather clear, but why wouldn't a type as basic as boolean not be allowed? Especially since any is authorized. This is clearly a limitation to using the library.

Your contribution

I seems like a few lines of code to change in tools.py (https://github.com/huggingface/transformers/blob/main/src/transformers/agents/tools.py)

LysandreJik commented 1 day ago

cc @aymeric-roucher