Skip to content

Both functionTool & VertexRagRetrieval works partially #352

@harry-yoo-eb

Description

@harry-yoo-eb

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
400 returned by gemini 2.5 flash
only when

  • functionResponse exists in contents when tools contain both function tools AND VertexRagRetrieval

To Reproduce
Steps to reproduce the behavior:

  1. Prepare MultiToolAgent.java to execute
  2. Update MultiToolAgent.java code with
        // Define the location for your service
        String location = "us-central1"; // Your target region

        // Construct the regional endpoint
        String endpoint = String.format("%s-aiplatform.googleapis.com:443", location);

        // Create service settings with the explicit endpoint
        VertexRagServiceSettings vertexRagServiceSettings =
                VertexRagServiceSettings.newBuilder().setEndpoint(endpoint).build();

        // Create the client with the new settings
        VertexRagServiceClient vertexRagServiceClient =
                VertexRagServiceClient.create(vertexRagServiceSettings);
...
...
                .tools(
                        FunctionTool.create(MultiToolAgent.class, "getWeather"),
                        new VertexAiRagRetrieval(
                                "my docs",
                                "This provides my docs",
                                vertexRagServiceClient,
                                "projects/{prj-id}/locations/us-central1",
                                List.of(RetrieveContextsRequest.VertexRagStore.RagResource.newBuilder().setRagCorpus("projects/{prj-id}/locations/us-central1/ragCorpora/{corpus_id}").build()),
                                null)
                )
  1. Start MultiToolAgent.java
  2. Ask questions related to function call
    -> 400 returned
    java.util.concurrent.ExecutionException: com.google.genai.errors.ClientException: 400 Bad Request. Request contains an invalid argument.

Expected behavior
LLM answers correctly, not 400

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Java version:
  • ADK version(see maven dependency): 0.2.0

Additional context

  • This happens only when input prompt triggers function when both functions tool & vertexRagRetrieval exist.
  • That means, this does not happen with either tool
  • This does not happen when input prompt triggers only vertexRagRetrieval in LLM. (answer is correct based on my RAG)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions