Skip to content

fix(config): map skip_vectorization for properties created with vector_config - #2228

Open
chrikrah wants to merge 1 commit into
weaviate:mainfrom
chrikrah:fix/property-skip-vector-config
Open

chrikrah wants to merge 1 commit into
weaviate:mainfrom
chrikrah:fix/property-skip-vector-config

Conversation

@chrikrah

Copy link
Copy Markdown

The Property docstring says skip_vectorization skips vectorization of the property, but on a collection created with vector_config=Configure.Vectors... it has no effect. __add_props in classes/config.py reads the vectorizers from vectorizer_config only, so the two flags go out as raw snake_case keys, which the server drops. This collects the vectorizers from vector_config too. No open issue covers it.

Before, at d1e185e:

$ python demo.py   # vector_config=Configure.Vectors.text2vec_openai(), one property with skip_vectorization=True
[{"name": "secret", "dataType": ["text"], "skip_vectorization": true, "vectorize_property_name": true}]

After:

$ python demo.py
[{"name": "secret", "dataType": ["text"], "moduleConfig": {"text2vec-openai": {"skip": true, "vectorizePropertyName": true}}}]

config.add_property already builds this moduleConfig from vectorConfig (config/executor.py:306), and test_add_property_with_vectorizer asserts it against a server.

One side effect: every property on this path now also sends vectorizePropertyName: true, the documented default that vectorizer_config and add_property already send, where today the server applies its own default of false (server modules/text2vec-openai/ent/class_settings.go:31). I kept it consistent with those paths, since sending only the flags a user set would change _to_dict for all three.

Verification

$ pytest test -q           # Python 3.12.6
565 passed, 1 skipped
$ pytest mock_tests -q
71 passed
$ ruff check weaviate test mock_tests integration packages/web   # ruff 0.14.7
All checks passed!
$ pyright weaviate/collections/classes/config.py                 # pyright 1.1.399
0 errors, 0 warnings, 0 informations
# not run: integration/ (needs a server)

Baseline on d1e185e is 564 passed, 1 skipped, so the delta is the one new test. Reverting classes/config.py and keeping it gives 1 failed, 564 passed.

@g-despot are you fine with that default flip here, or should _to_dict stop sending unset flags everywhere in a separate PR?

…r_config

`_CollectionConfigCreate.__add_props` read the vectorizers only from the
deprecated `vectorizer_config`. A collection created with
`vector_config=Configure.Vectors...` passed `None` to `Property._to_dict`,
so `skip_vectorization` and `vectorize_property_name` went out as raw
snake_case keys that the server ignores, and the property was vectorized
anyway. Collect the vectorizers from `vector_config` too, so the property
gets a `moduleConfig` entry per vectorizer, as it does for named vectors.

Signed-off-by: Christopher Krah <48338417+chrikrah@users.noreply.github.com>

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

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.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants