mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(vertex-ai): cover preserved native content variants
This commit is contained in:
parent
103b3a9b81
commit
0d847c8149
2 changed files with 5 additions and 1 deletions
|
|
@ -84,7 +84,9 @@ class VertexAIGoogleGenAIConfig(GoogleGenAIConfig):
|
|||
|
||||
vertex_contents = (
|
||||
[
|
||||
{**content, "role": content.get("role", "user")} if isinstance(content, dict) else content
|
||||
({**content, "role": "user"} if "role" not in content else content)
|
||||
if isinstance(content, dict)
|
||||
else content
|
||||
for content in contents
|
||||
]
|
||||
if isinstance(contents, list)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ def test_transform_generate_content_request_defaults_omitted_role():
|
|||
contents = [
|
||||
{"parts": [{"text": "Hello"}]},
|
||||
{"role": "model", "parts": [{"text": "Hi"}]},
|
||||
"Raw content",
|
||||
]
|
||||
|
||||
result = config.transform_generate_content_request(
|
||||
|
|
@ -20,5 +21,6 @@ def test_transform_generate_content_request_defaults_omitted_role():
|
|||
assert result["contents"] == [
|
||||
{"role": "user", "parts": [{"text": "Hello"}]},
|
||||
{"role": "model", "parts": [{"text": "Hi"}]},
|
||||
"Raw content",
|
||||
]
|
||||
assert "role" not in contents[0]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue