Copybara import of the project:

--
ad923c2c8c503ba73c62db695e88f1a3ea1aeeea by YU MING HSU <abego452@gmail.com>:

docs: enhance Contribution process within CONTRIBUTING.md

--
8022924fb7e975ac278d38fce3b5fd593d874536 by YU MING HSU <abego452@gmail.com>:

fix: move _maybe_append_user_content from google_llm.py to base_llm.py,
so subclass can get benefit from it, call _maybe_append_user_content
from generate_content_async within lite_llm.py

--
cf891fb1a3bbccaaf9d0055b23f614ce52449977 by YU MING HSU <abego452@gmail.com>:

fix: modify install dependencies cmd, and use pyink to format codebase
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/428 from hsuyuming:fix_litellm_error_issue_427 dbec4949798e6399a0410d1b8ba7cc6a7cad7bdd
PiperOrigin-RevId: 754124679
This commit is contained in:
hsuyuming
2025-05-02 13:59:14 -07:00
committed by Copybara-Service
parent 8f94a0c7b3
commit 879064343c
14 changed files with 170 additions and 85 deletions

View File

@@ -262,6 +262,67 @@ async def test_generate_content_async(mock_acompletion, lite_llm_instance):
)
litellm_append_user_content_test_cases = [
pytest.param(
LlmRequest(
contents=[
types.Content(
role="developer",
parts=[types.Part.from_text(text="Test prompt")]
)
]
),
2,
id="litellm request without user content"
),
pytest.param(
LlmRequest(
contents=[
types.Content(
role="user",
parts=[types.Part.from_text(text="user prompt")]
)
]
),
1,
id="litellm request with user content"
),
pytest.param(
LlmRequest(
contents=[
types.Content(
role="model",
parts=[types.Part.from_text(text="model prompt")]
),
types.Content(
role="user",
parts=[types.Part.from_text(text="user prompt")]
),
types.Content(
role="model",
parts=[types.Part.from_text(text="model prompt")]
)
]
),
4,
id="user content is not the last message scenario"
)
]
@pytest.mark.parametrize(
"llm_request, expected_output",
litellm_append_user_content_test_cases
)
def test_maybe_append_user_content(lite_llm_instance, llm_request, expected_output):
lite_llm_instance._maybe_append_user_content(
llm_request
)
assert len(llm_request.contents) == expected_output
function_declaration_test_cases = [
(
"simple_function",