Well done on all the work for the google-genai library.
It would be great if we could specify custom HTTP headers for the ChatModel properties.
https://github.com/googleapis/google-cloud-java/blob/230fed0de5cf21f75da451643df383a469ee5a8b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/VertexAI.java#L263
Comment From: RyanHowell30
@markpollack in addition, I tried pulling in the library and setting my BOM version to 1.0.2 and nothing comes up in my gradle dependencies.
Comment From: ilayaperumalg
in addition, I tried pulling in the library and setting my BOM version to 1.0.2 and nothing comes up in my gradle dependencies.
@RyanHowell30 The Google GenAI support has been added into 1.1.0 only. Please try the latest available milestone 1.1.0-M1 or the snapshot 1.1.0-SNAPSHOT. Thanks
Comment From: ilayaperumalg
It would be great if we could specify custom HTTP headers for the ChatModel properties.
@ddobrin This sounds like a new feature to the GenAI model. What do you think?
Comment From: RyanHowell30
@ddobrin @ilayaperumalg https://github.com/googleapis/java-genai/blob/main/src/main/java/com/google/genai/Models.java#L6556 which takes https://github.com/googleapis/java-genai/blob/main/src/main/java/com/google/genai/types/HttpOptions.java#L32 and then here is the header section to set the headers https://github.com/googleapis/java-genai/blob/main/src/main/java/com/google/genai/types/HttpOptions.java#L97
Comment From: RyanHowell30
Work around for the unable to install the library issue here
Comment From: olliebroadhurst-impact
+1 to this, custom headers will be welcome for proxy settings too
Comment From: EugeneKopaev
Are there plans to support setting the cachedContent property through GoogleGenAiChatOptions? At the moment this capability is unavailable, while the google-genai SDK already provides it.
Comment From: ddobrin
@ilayaperumalg @RyanHowell30 - I will look into it, as there could be additional changes in the latest version of the GenAI SDK.
@EugeneKopaev - Yes, that was the plan initially, when ThinkIngBudget was supported. There was an issue which needed to be resolved. Allow me to check if it is so and then I'll add the support for CachedContent. Please be aware that the Google GenAI SDK is adding new functionality in weekly/bi-weekly releases, therefore not all SDK features are available in Spring AI.
Current 1.1.0 SNAPSHOT supports v1.16.0 and 1.17.0 has been released yesterday
Comment From: RyanHowell30
@ddobrin seems like I managed to configure Custom HTTP Headers.
Set up a GenAiClient: `@Configuration @Log4j2 public class CustomGoogleGenAiClientConfig {
@Value("${spring.ai.google.genai.project-id}")
private String projectId;
@Value("${spring.ai.google.genai.location}")
private String location;
@Bean(name = "customGenAiClient")
public Client customGenAiClient() {
    Map<String, String> headers = Map.of("X-Vertex-AI-LLM-Request-Type", "batch");
    HttpOptions httpOptions = HttpOptions.builder().headers(headers).build();
    log.info("Creating Custom Google GenAI Client for project: {} in location: {}", projectId, location);
    return Client.builder()
            .project(projectId)
            .location(location)
            .httpOptions(httpOptions) // over here
            .vertexAI(true)
            .build();
}
} `
Then provided this client config here: `[@Bean public GoogleGenAiChatModel customChatModel(@Qualifier("customGenAiClient") Client customGenAiClient) { GoogleGenAiChatOptions chatOptions = GoogleGenAiChatOptions.builder() .model("gemini-2.5-flash") .responseMimeType("application/json") .temperature(0.1) .safetySettings(safetySettings) .thinkingBudget(thinkingTokens) .build();
    return GoogleGenAiChatModel.builder()
            .genAiClient(customGenAiClient)
            .defaultOptions(chatOptions)
            .build();
}]`
Comment From: EugeneKopaev
@ddobrin Thanks, I appreciate it. Please let me know if it's possible to do in the coming days or if it will require more time, as my team is in the middle of AI agent implementation and it would be nice to understand in which direction to move (keep using Spring AI or switch to the native GenAI SDK). Looking at the code, it seems like it should be a simple task: adding a new property to org.springframework.ai.google.genai.GoogleGenAiChatOptions and updating the org.springframework.ai.google.genai.GoogleGenAiChatModel.createGeminiRequest method to set the cachedContent parameter in the com.google.genai.types.GenerateContentConfig builder.
Comment From: ddobrin
@EugeneKopaev - yes, week-end or latest next week. There are a couple of other features which are requested and need to be added as well.
Version 1.17.0 of the SDK has been released.
The choice will always come from: - SDK - released by the provider, features available right after release, although more verbose - Spring AI - auto-configuration, abstractions to speed up dev and increase the DevX
Comment From: EugeneKopaev
@ddobrin Sounds great. Thanks for the effort. We will wait for Spring AI to incorporate this functionality.