Adds support for SafetySettings configuration to VertexAiGeminiChatModel
and VertexAiGeminiChatOptions
See https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters for reference.
Should fix https://github.com/spring-projects/spring-ai/issues/942
Comment From: terussell85
@tzolov I updated the code with updates from the spring-javaformat
plugin. Apologies that I didn't catch that the first time.
Comment From: terussell85
Great feedback. I'll take a look and get back to you.
Comment From: terussell85
@tzolov I think we're good to go now.
Changes since last review:
1. Introduce new VertexAiGeminiSafetySetting
class to allow for declarative configuration. This is converted to the Vertex AI setting at request-time.
2. Not null assertions for safetySettings
on both the Builder and the class property.
3. Verified that declarative configuration works
4. Updated docs
I made some changes to the originally suggested SafetySetting
class, including renaming it and adding a Builder. I also kept the newly defined Spring enums both value- and name-consistent with the Gemini enums so that there won't be accidental confusion of users.
Let me know if there is anything else.
Comment From: tzolov
thanks @terussell85
Comment From: tzolov
rebased and merged at c14618fe9a9e2ea158e9892a61e77bf7187e426a