Skip to content

Conversation

@kevinkassimo
Copy link
Contributor

@kevinkassimo kevinkassimo commented Nov 2, 2025

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Testing Plan

Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Please include a summary of passed pytest results.

# Others are skipped since no change

$ pytest ./tests/unittests/models/test_litellm.py

=========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.11.13, pytest-8.4.2, pluggy-1.6.0
rootdir: /Users/kunqian/Projects/Agents/adk-python
configfile: pyproject.toml
plugins: mock-3.15.1, asyncio-1.2.0, anyio-4.11.0, xdist-3.8.0, langsmith-0.4.39
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 69 items

tests/unittests/models/test_litellm.py .....................................................................                                                        [100%]

============================================================================ warnings summary =============================================================================
.venv/lib/python3.11/site-packages/google/genai/types.py:9906
  /Users/kunqian/Projects/Agents/adk-python/.venv/lib/python3.11/site-packages/google/genai/types.py:9906: PydanticDeprecatedSince212: Using `@model_validator` with mode='after' on a classmethod is deprecated. Instead, use an instance method. See the documentation at https://docs.pydantic.dev/2.12/concepts/validators/#model-after-validator. Deprecated in Pydantic V2.12 to be removed in V3.0.
    @model_validator(mode='after')  # type: ignore[arg-type]

tests/unittests/models/test_litellm.py::test_get_completion_inputs_generation_params
  tests/unittests/models/test_litellm.py:1893: PytestWarning: The test <Function test_get_completion_inputs_generation_params> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.asyncio

tests/unittests/models/test_litellm.py::test_get_completion_inputs_empty_generation_params
  tests/unittests/models/test_litellm.py:1925: PytestWarning: The test <Function test_get_completion_inputs_empty_generation_params> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.asyncio

tests/unittests/models/test_litellm.py::test_get_completion_inputs_minimal_config
  tests/unittests/models/test_litellm.py:1940: PytestWarning: The test <Function test_get_completion_inputs_minimal_config> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.asyncio

tests/unittests/models/test_litellm.py::test_get_completion_inputs_partial_generation_params
  tests/unittests/models/test_litellm.py:1957: PytestWarning: The test <Function test_get_completion_inputs_partial_generation_params> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    @pytest.mark.asyncio

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================================== 69 passed, 5 warnings in 3.54s ======================================================================

Manual End-to-End (E2E) Tests:

Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix.

Follow steps in the linked issue, and upload a JSON file.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Add any other context or screenshots about the feature request here.

@gemini-code-assist
Copy link

Summary of Changes

Hello @kevinkassimo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the LiteLLM integration by enabling it to process JSON file types. This expands the model's capability to handle a broader range of structured data inputs, improving its versatility for various use cases requiring JSON content analysis or processing.

Highlights

  • JSON File Type Support: Added support for application/json as a recognized file type within the LiteLLM model integration, allowing JSON files to be processed similarly to PDF files.
  • Generalized File Type Handling: The internal _get_content function was updated to use a set of _SUPPORTED_FILE_CONTENT_MIME_TYPES, making it more extensible for future additions of supported file types beyond just PDF and JSON.
  • Expanded Unit Test Coverage: New parameterized tests were introduced and existing tests were refactored to ensure proper handling of both PDF and JSON file URIs, as well as inline JSON data, verifying the new functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the models [Component] Issues related to model support label Nov 2, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for JSON file types in LiteLLM, which is a valuable enhancement. The implementation is correct, using a set of supported MIME types for easy extension. The accompanying tests are thorough and have been effectively refactored to use parametrization, covering both PDF and the new JSON type for file URIs. I have one suggestion to further improve test maintainability by combining similar test cases.

@kevinkassimo kevinkassimo changed the title fix: support JSON file type with LiteLLM fix: support json and txt file type with LiteLLM Nov 2, 2025
@ryanaiagent ryanaiagent self-assigned this Nov 3, 2025
@ryanaiagent
Copy link
Collaborator

Hi @kevinkassimo, Thank you for your contribution through this pull request!
This PR has merge conflicts that require changes from your end. Could you please rebase your branch with the latest main branch to address these? Once this is complete, please let us know so we can proceed with the review.

@kevinkassimo
Copy link
Contributor Author

Merged through other channels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models [Component] Issues related to model support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiteLLM upload json file is not supported

3 participants