refactor(vertex_ai): remove dead code and align tests with production usage

- Remove unreachable snake_case parent_key checks in field transformation.
- Remove redundant parent_key argument from unit tests to match production invocation.
This commit is contained in:
prophet_system_team 2026-03-23 20:42:21 +05:30
parent 109fe0df45
commit 699cedb96e
2 changed files with 2 additions and 4 deletions

View file

@ -257,13 +257,11 @@ def _transform_part_to_httpx_format(part: dict, parent_key: Optional[str] = None
# These are user-defined keys that should be preserved.
should_preserve_keys = False
if isinstance(v, dict):
if k == "args" and parent_key in ["functionCall", "function_call"]:
if k == "args" and parent_key == "functionCall":
should_preserve_keys = True
elif k == "response" and parent_key in [
"functionResponse",
"function_response",
"toolResponse",
"tool_response",
]:
should_preserve_keys = True
elif k == "properties":

View file

@ -309,7 +309,7 @@ def test_vertex_transformation_field_casing():
"args": {"security_risk": "high", "other_param": 123},
}
}
transformed = _transform_part_to_httpx_format(part, parent_key="functionCall")
transformed = _transform_part_to_httpx_format(part)
assert "functionCall" in transformed
assert "args" in transformed["functionCall"]
# Keys in args should NOT be camelCased