Skip to content

[Bug]: tool property descriptions are duplicated in anyOf elements #13683

@phemmer

Description

@phemmer

What happened?

When sending a request to LiteLLM (running it as a proxy) with tools that have parameters using anyOf, the parameter description is duplicated on each of them.

For example:
testdata.json:

{
	"model": "gemini/2.5-flash",
	"stream": false,
	"tool_choice": "auto",
	"tools": [
		{
			"type": "function",
			"function": {
				"name": "test",
				"description": "this is a test tool",
				"parameters": {
					"additionalProperties": false,
					"properties": {
						"myprop": {
							"default": null,
							"description": "this is a test property",
							"anyOf": [
								{"type": "number"},
								{"type": "string"},
								{"type": "null"}
							]
						}
					},
					"type": "object"
				}
			}
		}
	],
	"messages": [
		{
			"role": "user",
			"content": "hello"
		}
	]
}
curl -v http://localhost:4001/chat/completions -X POST -H 'content-type: application/json' -d @testdata.json

If you then look at the request in the logs view in the UI, you see:

{
  "model": "gemini/2.5-flash",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "test",
        "parameters": {
          "type": "object",
          "properties": {
            "myprop": {
              "anyOf": [
                {
                  "type": "number",
                  "nullable": true,
                  "description": "this is a test property"
                },
                {
                  "type": "string",
                  "nullable": true,
                  "description": "this is a test property"
                }
              ],
              "default": null,
              "description": "this is a test property"
            }
          }
        },
        "description": "this is a test tool"
      }
    }
  ],
  "stream": false,
  "messages": [
    {
      "role": "user",
      "content": "hello"
    }
  ],
  "tool_choice": "auto"
}

Note the this is a test property being duplicated on every anyOf element.

Relevant log output

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

b1cab7d09edd2b9c9e0634ad4ba5008a88793dc3b9aac8a40a52d312436b15ad
sha256:284b857e1f5f611baf07eddf75956436b7d0a212cc1b28839a3ea8bada5f11c6
^ That's the container image ID since that's how I'm running it. I pulled the image the other day, so it should be recent. But I have honestly no clue what version it is. I looked through the startup output. I looked through the UI. I looked through the API endpoints. Nowhere could I find anything where it would tell me what its version is. So as a side item to this issue, I might suggest making this easier to discover.

Twitter / LinkedIn details

No response

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