dust-tt / dust

Amplify your team's potential with customizable and secure AI assistants.
https://dust.tt
MIT License
938 stars 107 forks source link

Fix empty tools parameters for Google AI #5954

Closed flvndvd closed 3 months ago

flvndvd commented 3 months ago

Description

See https://github.com/dust-tt/tasks/issues/986.

This PR addresses a problem with tools in Open AI that do not accept an empty value as parameters, despite the documentation stating that most of these fields are optional. This PR includes a verification in the TryFrom for GoogleAIStudioFunctionDeclaration to determine if the function requires parameters. If it does not, we assign it a value of None.

Before:

 Object {
                    "name": String("reply_to_user"),
                    "description": String("Reply to the user with a message. You don't need to generate any arguments for this function."),
                    "parameters": Object {
                       "type": "object",
                       "properties": {},
                       "required": []
                    },
                },

After:

 Object {
                    "name": String("reply_to_user"),
                    "description": String("Reply to the user with a message. You don't need to generate any arguments for this function."),
                    "parameters": Null,
                },

Risk

Deploy Plan