It does not forcefully use the tools? The tools are just sent to the api, and the api figures it out under the hood
Although here, you've given a function with
- a non-deacriptive name
- no description
So the model is probably just confused.
Try either adding a docstring or providing a description to from_defaults. And maybe give it a better name?
def give_me_20():
"""Useful for getting the number 20."""
return 20
tool = FunctionTool.from_defaults(fn=give_me_20)
Here it uses the function name as the name, and the docstring as description. You can also manually override this
FunctionTool.from_defaults(fn=fn, name="...", description="...")