I am creating an assistant and I need to pass a callback as a function calling param like this:
“description”: “Next action to execute if needed. Receives the queriesData object as param”
But function is not a valid data type.
Is there any way to specify a callback/lambda as a function calling param?
In my experience, for function calling, you need to pass in at least one function argument. For any other issues, check out the Function Calling API Documentation.
The AI is writing JSON. JSON data can only be of “string”, “number”, “boolean” and then containers for them such as array or object.
It is you trying to parse and validate that JSON, though.
Technically nothing on the API will prevent the AI from writing raw text (or writing bad json) as a function return. It is just the fine-tune that function models have, and you only being able to provide a specification that prompts for such json.
Anything you can get the AI to write reliably can be output. This particular training won’t be there, so it will take some carefully-considered function parameter descriptions and system messages.
If the “assistants” doesn’t let you receive arbitrary tool or function call text, add one more thing to the “do-not-use-assistants” list.