Skip to content

Litellm unit test failure by default #4225

@DineshThumma9

Description

@DineshThumma9

Describe the bug

Litellm unit test failure

To Reproduce
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:

  1. clone adk-python repo or run as is
  2. Run pytest ./tests/unittests/models or just ./tests/unitests
    3.You will see
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

================================================================= short test summary info =================================================================
FAILED tests/unittests/models/test_litellm.py::test_model_response_to_chunk[response2-expected_chunks2-expected_usage_chunk2-None] - assert False
FAILED tests/unittests/models/test_litellm.py::test_completion_additional_args - assert 0 == 4
FAILED tests/unittests/models/test_litellm.py::test_completion_with_drop_params - assert 0 == 4
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_stream - assert 0 == 4
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_stream_sets_finish_reason - IndexError: list index out of range
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_stream_with_usage_metadata - assert 0 == 4
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_multiple_function_calls - assert 0 > 0
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_non_compliant_multiple_function_calls - assert 0 > 0
FAILED tests/unittests/models/test_litellm.py::test_generate_content_async_stream_with_empty_chunk - assert 0 == 1
================================================ 9 failed, 3929 passed, 2130 warnings in 116.30s (0:01:56) ================================================
Exception ignored in atexit callback: <function BigQueryAgentAnalyticsPlugin._atexit_cleanup at 0x73163a779f80>


Expected behavior
All unit tests should pass by default
I tried this cloning a fresh repo and running pytest ./tests/unitests without any code changes i get these 9 errors consistently
I did'nt see any docs or anything mentioning highlighting this issue

**Desktop **

  • OS: Ubuntu 24.03.03 LTS
  • Python version(python -V):3.11.14
  • ADK version(pip show google-adk): 1.22.1

Additional context
I always check other pr and they too fail in python (3,10) test related to litellm

From what i could gather this is resulting from changes of litellm behavior and outdated test cases
Like finsh_reason is being set to stop by default instead of None
Handling in parsing partial json chucks

Metadata

Metadata

Assignees

Labels

models[Component] Issues related to model support

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions