Q: 'invalid properties' error when creating a collection (Python client versions 4.16.0 to 4.16.3)

We notice that in Weaviate Python client versions 4.16.0 to 4.16.3, the following pattern when creating a collection with a text2vec_xxx vectorizer will result in an error:

python

client.collections.create(
    "CollectionName",
    vector_config=Configure.Vectorizer.text2vec_cohere(),  # also applies to other vectorizers
)

Error Message

The error message looks like this:

UnexpectedStatusCodeError: Collection may not have been created properly.! Unexpected status code: 422, with response body: {'error': [{'message': "module 'text2vec-cohere': invalid properties: didn't find a single property which is of type string or text and is not excluded from indexing....

This is a known issue that occurs when setting a vectorizer definition without defining any TEXT or TEXT_ARRAY properties in the collection, while relying on AutoSchema to create the data schema automatically.

Solution

This issue is addressed in Weaviate Python client patch release 4.16.4. We recommend updating to version 4.16.4 of the Weaviate Python client, or later.

Workarounds for Affected Versions

If you are unable to update your Weaviate Python client version from the affected ones (4.16.0 to 4.16.3), you can work around this issue in one of two ways:

Option 1: Explicitly Define a TEXT Property

Define at least one TEXT or TEXT_ARRAY property in the collection schema:

client.collections.create(
    "CollectionName",
    properties=[
        Property(name="<property_name>", data_type=DataType.TEXT),
    ],
    vector_config=Configure.Vectorizer.text2vec_cohere(),
    # Additional configuration not shown
)

Option 2: Enable Collection Name Vectorization

Set vectorize_collection_name to True in the vectorizer definition:

client.collections.create(
    "CollectionName",
    vector_config=Configure.Vectorizer.text2vec_cohere(
        vectorize_collection_name=True
    ),
    # Additional configuration not shown
)