这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: Sanitize function names for gemini function calling #4452

@shatfield4

Description

@shatfield4

How are you running AnythingLLM?

Docker (local)

What happened?

We should add a prefix for all tool names or sanitize tool names before sending tool calls because gemini is very specific with how functions are named when utilizing tool calling.

Are there known steps to reproduce?

Function name that was automatically generated when pulling in from AnythingLLM Hub: 1aMsI3bgiXs0a3uiRBHm

Response received from gemini tool calling when function name does not meet correct schema:

    {
        "error": {
            "code": 400,
            "message": "* GenerateContentRequest.tools[0].function_declarations[6].name: Invalid function name. Must start with a letter or an underscore. Must be alphameric (a-z, A-Z, 0-9), underscores (_), dots (.), colons (:), or dashes (-), with a maximum length of 64.\n",
            "status": "INVALID_ARGUMENT"
        }
    }
]`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions