litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Feature]: Support broader range on characters in function name

Open zakshyman opened this issue 2 years ago • 1 comments

The Feature

Currently tool function names should contain a-z, A-Z, 0-9, underscores and dashes, with a maximum length of 64 characters.

While openai models do support broader range. For example it is possible to use Ä Ö Ü ß.

Please support the same function tools limitation as openai.

Motivation, pitch

I have configurable list of services for the user, that translates to the list of functions. User creates a new functions and specify their name+description. In their own language (e.g. German).

For LLM better understand when this function should run - it is good to have meaningful name, and stick to original user's name, which can be in different language.

Twitter / LinkedIn details

No response

zakshyman avatar Mar 14 '24 07:03 zakshyman

what is needed to support this? I don't think we set any requirements for this @zshimanchik

krrishdholakia avatar Mar 18 '24 17:03 krrishdholakia

Here is an example of the issue: function name is get_current_wäther with a German ä:

tools = [
            {
                "type": "function",
                "function": {
                    "name": "get_current_wäther",
                    "description": "Get the current weather in a given location",
                    "parameters": {
                        "type": "object",
                        "properties": {
                            "location": {
                                "type": "string",
                                "description": "The city and state, e.g. San Francisco, CA",
                            },
                            "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
                        },
                        "required": ["location"],
                    },
                },
            }
        ]

This results in an error from LiteLLM. In OpenAI the function name works without a problem.

Error occurred: OpenAIException - Error code: 400 - {'error': {'message': "'get_current_wäther' does not match '^[a-zA-Z0-9_-]{1,64}$' - 'tools.0.function.name'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

widike avatar Apr 04 '24 17:04 widike

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Jan 29 '25 00:01 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Apr 30 '25 00:04 github-actions[bot]