Skip to content

Conversation

@kayoch1n
Copy link
Contributor

Title

fix(bedrock): handle None value of "parameters" correctly

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
✅ Test

Changes

Some agent frameworks provide a None value when a tool has no parameters. For example,

{"type":"function","function":{"name":"weather","description":"Get current weather information","parameters":null}}

The bedrock function _bedrock_tools_pt is using dict.get(key, default) which provides a default value only when there is no such key. However, when the key is present and is None, the default value will not be used. In such case, litellm will raise a KeyError when trying to pop $defs from None.

This PR changed the way of bedrock checking parameters, by adding a if-check on parameters and setting the default value

@vercel
Copy link

vercel bot commented Nov 28, 2025

@kayoch1n is attempting to deploy a commit to the CLERKIEAI Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant