[GH-ISSUE #4452] [BUG]: Sanitize function names for gemini function calling #2836

Closed
opened 2026-02-22 18:31:28 -05:00 by yindo · 0 comments
Owner

Originally created by @shatfield4 on GitHub (Sep 30, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4452

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"
        }
    }
]`
Originally created by @shatfield4 on GitHub (Sep 30, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4452 ### 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](hub.anythingllm.com): 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" } } ]`
yindo added the bug label 2026-02-22 18:31:28 -05:00
yindo closed this issue 2026-02-22 18:31:28 -05:00
yindo changed title from [BUG]: Sanitize function names for gemini function calling to [GH-ISSUE #4452] [BUG]: Sanitize function names for gemini function calling 2026-06-05 14:48:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2836