It is not merely some way of getting an output - the function by its description must describe some service offered to the AI that can help answer user questions. When you do that, there is no need to specify a tool choice (which can loop the AI if not used intelligently).
This assistant has a function:
{
"name": "rand_int",
"description": "A function that can generate true random integer numbers for the AI. Use for making choices, or whenever breaking deterministic behavior of language generation is desired or required.",
"strict": true,
"parameters": {
"type": "object",
"required": [
"range_start",
"range_end"
],
"properties": {
"range_end": {
"type": "integer",
"description": "The inclusive end of the range"
},
"range_start": {
"type": "integer",
"description": "The inclusive start of the range"
}
},
"additionalProperties": false
}
}
Observe the AI call the function when not instructed. The function is useful.