mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix(types): annotate make_valid_bedrock_tool_use_id as Optional[str] -> Optional[str]
Greptile review caught that the helper passes None through unchanged, but the annotation said str -> str (which forced a # type: ignore[arg-type] in the empty-passthrough test). Match the annotation to the actual contract and drop the type: ignore. Behavior unchanged.
This commit is contained in:
parent
007e97d61e
commit
7fd8c255e9
2 changed files with 4 additions and 2 deletions
|
|
@ -5361,7 +5361,9 @@ def make_valid_bedrock_tool_name(input_tool_name: str) -> str:
|
|||
return valid_string
|
||||
|
||||
|
||||
def make_valid_bedrock_tool_use_id(input_tool_use_id: str) -> str:
|
||||
def make_valid_bedrock_tool_use_id(
|
||||
input_tool_use_id: Optional[str],
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Replaces any invalid characters in the input tool_use_id with underscores
|
||||
so it matches Bedrock Converse's required pattern ``^[a-zA-Z0-9_.:-]+$``.
|
||||
|
|
|
|||
|
|
@ -2818,7 +2818,7 @@ def test_make_valid_bedrock_tool_use_id_empty_passthrough():
|
|||
)
|
||||
|
||||
assert make_valid_bedrock_tool_use_id("") == ""
|
||||
assert make_valid_bedrock_tool_use_id(None) is None # type: ignore[arg-type]
|
||||
assert make_valid_bedrock_tool_use_id(None) is None
|
||||
|
||||
|
||||
def test_bedrock_tool_call_invoke_sanitizes_drifted_name_and_id():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue