feat(config): add location to Configure.Generative.google_vertex (#2073) - #2118
Open
Anai-Guo wants to merge 1 commit into
Open
feat(config): add location to Configure.Generative.google_vertex (#2073)#2118Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…viate#2073) The generative-google module in Weaviate core reads a ``location`` class setting (default ``us-central1``) alongside ``region``, but the Python client had no way to send it, so collections could not select a Vertex location from the client. Add ``location`` to ``_GenerativeGoogleConfig`` and expose it as an optional ``location`` argument on ``Configure.Generative.google_vertex``. It is omitted from the module config when left as ``None``, so the server default still applies and existing configurations are unchanged. Runtime (gRPC) generative parameters are unchanged: the ``GenerativeGoogle`` proto message has no ``location`` field yet, so query-time support has to wait for regenerated protos. Signed-off-by: Tai An <antai12232931@anaiguo.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
Author
|
I agree with the Weaviate Contributor License Agreement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2073.
Problem
The
generative-googlemodule in Weaviate core reads alocationclass setting (modules/generative-google/config/class_settings.go:locationProperty = "location",DefaultGoogleLocation = "us-central1"), separate from the existingregionsetting. The Python client's_GenerativeGoogleConfighasregionbut nolocation, so there is no way to set it fromConfigure.Generative.*— the server default always applies.Change
_GenerativeGoogleConfiggains an optionallocationfield.Configure.Generative.google_vertex(...)gains an optionallocationargument (documented as defaulting to the server-definedus-central1)._GenerativeGoogleConfig(palm,google,google_gemini) passlocation=None, so nothing changes for them.Because the field is
Optionaland the model is serialized withexclude_none, an unsetlocationis simply absent from the module config — existing collection configurations serialize byte-for-byte as before.Scope note
This covers the collection-config half of #2073 only. The runtime/query-time half is not included: the
GenerativeGooglegRPC message (weaviate/proto/v1/v6300/v1/generative_pb2.pyi) hasregionbut nolocationfield, which matches the issue's note that "this change needs newest protos". Once the protos carrylocation, the runtime provider inweaviate/collections/classes/generative.pycan be extended in a follow-up.Tests
Added two parametrized cases to
test_config_with_generative, which had nogoogle_vertexcoverage at all:google_vertex(project_id=...)→{"generative-palm": {"projectId": "project"}}(regression guard: no new key leaks in whenlocationis unset)google_vertex(...)with every argument, includingregionandlocation, asserting both land in the module configBoth failures are in
test/test_timeout.pyand reproduce identically on an unmodified checkout ofmain(ae327ca) on this machine — they are pre-existing and unrelated.Lint, matching
.pre-commit-config.yamlpins:🤖 Generated with Claude Code