Skip to content

Conversation

@calvingiles
Copy link

No description provided.

selcukgun and others added 24 commits June 5, 2025 22:46
Fixes google#973, google#1170

PiperOrigin-RevId: 767921051
… before 0.1 version

For context: tools/example_tool.py was created to replace LlmAgent.example

Also removes relevant usage in tests.

PiperOrigin-RevId: 768193042
PiperOrigin-RevId: 768583464
Merge google#1250

The `Args:` section in the docstring of the `cli_deploy_agent_engine` function was causing formatting issues in the help output, with line breaks not being rendered correctly.

This commit removes the redundant `Args:` section from the docstring. The help text for options is already comprehensively covered by the `help` attributes in the `@click.option` decorators, and `click` automatically lists the command's arguments.

This change ensures that the help output for
`adk deploy agent_engine --help` is clean, readable, and correctly formatted, relying on `click`'s standard help generation mechanisms.

After the fix:

(adk_test234) (base) hangfeilin@Hangfeis-MBP adk-python % adk deploy agent_engine --help
Usage: adk deploy agent_engine [OPTIONS] AGENT

  Deploys an agent to Agent Engine.

  Args:   agent (str): Required. The path to the agent to be deloyed.

  Example:

    adk deploy agent_engine --project=[project] --region=[region]     --staging_bucket=[staging_bucket] path/to/my_agent

Options:
  --project TEXT            Required. Google Cloud project to deploy the agent.
  --region TEXT             Required. Google Cloud region to deploy the agent.
  --staging_bucket TEXT     Required. GCS bucket for staging the deployment artifacts.
  --trace_to_cloud          Optional. Whether to enable Cloud Trace for Agent Engine.
  --adk_app TEXT            Optional. Python file for defining the ADK application (default: a file named agent_engine_app.py)
  --temp_folder TEXT        Optional. Temp folder for the generated Agent Engine source files. If the folder already exists, its
                            contents will be removed. (default: a timestamped folder in the system temp directory).
  --env_file TEXT           Optional. The filepath to the `.env` file for environment variables. (default: the `.env` file in
                            the `agent` directory, if any.)
  --requirements_file TEXT  Optional. The filepath to the `requirements.txt` file to use. (default: the `requirements.txt` file
                            in the `agent` directory, if any.)
  --help                    Show this message and exit.
COPYBARA_INTEGRATE_REVIEW=google#1250 from google:fix-1191-agent-engine-help d2d0e89
PiperOrigin-RevId: 769182740
…ifact description

PiperOrigin-RevId: 769203265
Merge google#1143

## Summary
Added a DeepWiki badge to the README.md file to provide users with easy access to interactive documentation that stays automatically updated.

## Changes Made
- Added DeepWiki badge to the existing badge section in README.md
- Badge links to: https://deepwiki.com/google/adk-python

## What is DeepWiki?
DeepWiki provides up-to-date documentation you can talk to, for every repository in the world. By adding this badge to our repository, we help users find and interact with documentation more easily. Users can ask questions about the codebase and get contextual answers based on the latest repository content.

The documentation is automatically updated weekly, ensuring that users always have access to the most current information about the ADK codebase, including new features, API changes, and code examples that reflect the latest development progress.

COPYBARA_INTEGRATE_REVIEW=google#1143 from takashikik:add-deepwiki-badge d9b8bc6
PiperOrigin-RevId: 769273276
Merge google#1211

### Description

When using the Google.GenAI backend (GEMINI_API), file uploads fail if the `file_data` or `inline_data` parts of the request contain a `display_name`. The Gemini API (non-Vertex) does not support this attribute, causing a `ValueError`.

This commit updates the `_preprocess_request` method in the `Gemini` class to sanitize the request. It now iterates through all content parts and sets `display_name` to `None` if the determined backend is `GEMINI_API`. This ensures compatibility, similar to the existing handling of the `labels` attribute.

Fixes google#1182

### Testing Plan

**1. Unit Tests**

- Added a new parameterized test `test_preprocess_request_handles_backend_specific_fields` to `tests/unittests/models/test_google_llm.py`.
- This test verifies:
  - When the backend is `GEMINI_API`, `display_name` in `file_data` and `inline_data` is correctly set to `None`.
  - When the backend is `VERTEX_AI`, `display_name` remains unchanged.
- All unit tests passed successfully.

```shell
pytest ./tests/unittests/models/test_google_llm.py                                    ░▒▓ ✔  adk-python   base   system   21:14:02 
============================================================================================ test session starts ============================================================================================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.6.0
rootdir: /Users/leo/PycharmProjects/adk-python
configfile: pyproject.toml
plugins: anyio-4.9.0, langsmith-0.3.42, asyncio-0.26.0, mock-3.14.0, xdist-3.6.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 20 items

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

============================================================================================ 20 passed in 3.19s =============================================================================================
```

**2. Manual End-to-End (E2E) Test**
I manually verified the fix using `adk web`. The test was configured to use a **Google AI Studio API key**, which is the scenario where the bug occurs.

- **Before the fix:**
  When uploading a file, the request failed with the error: `{"error": "display_name parameter is not supported in Gemini API."}`. This confirms the bug.

<img width="968" alt="Screenshot 2025-06-06 at 21 22 35" src="https://github.com/user-attachments/assets/f1ab2db2-d5ec-40fc-a182-9932562b21e1" />

- **After the fix:**
  With the patch applied, the same file upload was processed successfully. The agent correctly analyzed the file and responded without errors.

<img width="973" alt="Screenshot 2025-06-06 at 21 23 24" src="https://github.com/user-attachments/assets/e03228f6-0b7d-4bf9-955a-ac24efb4fb72" />

COPYBARA_INTEGRATE_REVIEW=google#1211 from ystory:fix/display-name d3efebe
PiperOrigin-RevId: 769278445
PiperOrigin-RevId: 769339396
…gress or experimental

User will see warning if they instantiate such class or call such functions.

PiperOrigin-RevId: 769413048
PiperOrigin-RevId: 769683091
…eeded after migrating to example tool

PiperOrigin-RevId: 769757803
This allows to protect against any write operations (e.g. update or delete a table), useful for some agents that must only be used in a read-only mode, while the user may have write permissions.

PiperOrigin-RevId: 769803741
@calvingiles calvingiles merged commit 2174bf5 into TradeMe:approval-fork Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.