fix: Add support for required params

Merge https://github.com/google/adk-python/pull/2212

This PR closes issue #2202

ADK was not parsing the required attribute when using LiteLLM, letting the LLM decide what is required vs not, not respecting function definitions.

## Test Plan

There's a fork of adk-python that is being running live for over 2 weeks in our production environment with millions of requests per day.

Below you can find a screenshot of the unit tests passing. I've also added one change to the test cases to cover this scenario

<img width="1904" height="483" alt="image" src="https://github.com/user-attachments/assets/5a6eb069-63ae-45a3-baca-6b01543f56fb" />

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2212 from thiagosalvatore:main 7de4037d8016389313f3fb22df40c12bac578523
PiperOrigin-RevId: 797393698
This commit is contained in:
Thiago Salvatore
2025-08-20 11:31:53 -07:00
committed by Copybara-Service
parent 5b999ed6fd
commit c144b5347c
2 changed files with 12 additions and 1 deletions
+4
View File
@@ -558,8 +558,10 @@ function_declaration_test_cases = [
"nested_key1": types.Schema(type=types.Type.STRING),
"nested_key2": types.Schema(type=types.Type.STRING),
},
required=["nested_key1"],
),
},
required=["nested_arg"],
),
),
{
@@ -581,8 +583,10 @@ function_declaration_test_cases = [
"nested_key2": {"type": "string"},
},
"type": "object",
"required": ["nested_key1"],
},
},
"required": ["nested_arg"],
},
},
},