Environment details
- Programming language: C#
- OS: Windows 11
- Language runtime version: .NET 8
- Package version: 1.6.1
- Microsoft.Extensions.AI: 10.4.1
Steps to reproduce
- Configure the client with
vertexAI: true
- Set up a chat client with
FunctionInvocation middleware and a tool
- Send a prompt that triggers a tool call
- The first LLM call succeeds and returns a function call
- The follow-up LLM call (with tool results in history) fails with:
Google.GenAI.ClientError: Unable to submit request because it must include at least one parts field,
which describes the prompt input. Learn more:
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
using System.ComponentModel;
using Google.Apis.Auth.OAuth2;
using Google.GenAI;
using Microsoft.Extensions.AI;
var vertexClient = new Client(
project: "my-project",
vertexAI: true,
location: "us-central1",
credential: GoogleCredential.GetApplicationDefault())
.AsIChatClient("gemini-3-flash-preview")
.AsBuilder()
.UseFunctionInvocation()
.Build();
[Description("Gets the current weather for a city")]
string GetWeather(string city) => $"Weather in {city}: 22°C, sunny";
var options = new ChatOptions { Tools = [AIFunctionFactory.Create(GetWeather)] };
// This fails on the second LLM call (after tool execution) with Vertex AI.
// Works fine with API key mode.
await foreach (var update in vertexClient.GetStreamingResponseAsync(
"What's the weather in Warsaw?", options))
{
Console.Write(update.Text);
}
Observed behavior
The follow-up request (after tool execution) contains a Content object with an empty parts array: { "role": "model", "parts": [] }. Vertex AI rejects this. The Gemini API (API key mode) tolerates it and works correctly.
The issue was introduced in 1.6.1. Version 1.6.0 works correctly with Vertex AI.
Environment details
Steps to reproduce
vertexAI: trueFunctionInvocationmiddleware and a toolObserved behavior
The follow-up request (after tool execution) contains a
Contentobject with an emptypartsarray:{ "role": "model", "parts": [] }. Vertex AI rejects this. The Gemini API (API key mode) tolerates it and works correctly.The issue was introduced in 1.6.1. Version 1.6.0 works correctly with Vertex AI.