From 9929051fd7165f36d1790a89c6a5b66531e3a198 Mon Sep 17 00:00:00 2001 From: Lijuan Tang Date: Sun, 31 May 2026 14:45:27 -0700 Subject: [PATCH] feat: export private collection config types as public aliases Users annotating parameters like `generative_config`, `reranker_config`, `vector_index_config`, etc. had to import private `_`-prefixed types, which pyright strict mode (`reportPrivateUsage: error`) flags as an error. Adds public TypeAlias entries for the 8 affected types, following the same pattern as `FilterReturn` introduced in #1993: - GenerativeConfigCreate (_GenerativeProvider) - InvertedIndexConfigCreate (_InvertedIndexConfigCreate) - MultiTenancyConfigCreate (_MultiTenancyConfigCreate) - ObjectTTLConfigCreate (_ObjectTTLConfigCreate) - ReplicationConfigCreate (_ReplicationConfigCreate) - RerankerConfigCreate (_RerankerProvider) - ShardingConfigCreate (_ShardingConfigCreate) - VectorIndexConfigCreate (_VectorIndexConfigCreate) All 8 aliases are exported from `weaviate.classes.config`. Closes #1994 --- weaviate/classes/config.py | 16 ++++++++++++++++ weaviate/collections/classes/config.py | 8 ++++++++ .../collections/classes/config_object_ttl.py | 5 +++++ .../collections/classes/config_vector_index.py | 5 ++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/weaviate/classes/config.py b/weaviate/classes/config.py index c154062d3..d286cdd2a 100644 --- a/weaviate/classes/config.py +++ b/weaviate/classes/config.py @@ -2,15 +2,21 @@ Configure, ConsistencyLevel, DataType, + GenerativeConfigCreate, GenerativeSearches, IndexName, + InvertedIndexConfigCreate, + MultiTenancyConfigCreate, PQEncoderDistribution, PQEncoderType, Property, Reconfigure, ReferenceProperty, + ReplicationConfigCreate, ReplicationDeletionStrategy, + RerankerConfigCreate, Rerankers, + ShardingConfigCreate, StopwordsCreate, StopwordsPreset, TextAnalyzerConfig, @@ -18,9 +24,11 @@ Tokenization, VectorDistances, ) +from weaviate.collections.classes.config_object_ttl import ObjectTTLConfigCreate from weaviate.collections.classes.config_vector_index import ( MultiVectorAggregation, VectorFilterStrategy, + VectorIndexConfigCreate, ) from weaviate.collections.classes.config_vectorizers import Multi2VecField, Vectorizers from weaviate.connect.integrations import Integrations @@ -30,17 +38,24 @@ "ConsistencyLevel", "Reconfigure", "DataType", + "GenerativeConfigCreate", "GenerativeSearches", "IndexName", "Integrations", + "InvertedIndexConfigCreate", "Multi2VecField", + "MultiTenancyConfigCreate", "MultiVectorAggregation", + "ObjectTTLConfigCreate", + "ReplicationConfigCreate", "ReplicationDeletionStrategy", + "RerankerConfigCreate", "Property", "PQEncoderDistribution", "PQEncoderType", "ReferenceProperty", "Rerankers", + "ShardingConfigCreate", "StopwordsCreate", "StopwordsPreset", "TextAnalyzerConfig", @@ -49,4 +64,5 @@ "Vectorizers", "VectorDistances", "VectorFilterStrategy", + "VectorIndexConfigCreate", ] diff --git a/weaviate/collections/classes/config.py b/weaviate/collections/classes/config.py index 0f6d974c0..48c053738 100644 --- a/weaviate/collections/classes/config.py +++ b/weaviate/collections/classes/config.py @@ -3101,3 +3101,11 @@ def multi_tenancy( autoTenantCreation=auto_tenant_creation, autoTenantActivation=auto_tenant_activation, ) + + +GenerativeConfigCreate: TypeAlias = _GenerativeProvider +InvertedIndexConfigCreate: TypeAlias = _InvertedIndexConfigCreate +MultiTenancyConfigCreate: TypeAlias = _MultiTenancyConfigCreate +ReplicationConfigCreate: TypeAlias = _ReplicationConfigCreate +RerankerConfigCreate: TypeAlias = _RerankerProvider +ShardingConfigCreate: TypeAlias = _ShardingConfigCreate diff --git a/weaviate/collections/classes/config_object_ttl.py b/weaviate/collections/classes/config_object_ttl.py index ec15a55b8..f7041b22f 100644 --- a/weaviate/collections/classes/config_object_ttl.py +++ b/weaviate/collections/classes/config_object_ttl.py @@ -1,6 +1,8 @@ import datetime from typing import Optional +from typing_extensions import TypeAlias + from weaviate.collections.classes.config_base import _ConfigCreateModel, _ConfigUpdateModel @@ -156,3 +158,6 @@ def delete_by_date_property( filterExpiredObjects=filter_expired_objects, defaultTtl=ttl_offset, ) + + +ObjectTTLConfigCreate: TypeAlias = _ObjectTTLConfigCreate diff --git a/weaviate/collections/classes/config_vector_index.py b/weaviate/collections/classes/config_vector_index.py index ff6a0ba40..a60a2048d 100644 --- a/weaviate/collections/classes/config_vector_index.py +++ b/weaviate/collections/classes/config_vector_index.py @@ -3,7 +3,7 @@ from typing import Any, Dict, Literal, Optional, overload from pydantic import Field -from typing_extensions import deprecated +from typing_extensions import TypeAlias, deprecated from weaviate.collections.classes.config_base import ( _ConfigCreateModel, @@ -670,3 +670,6 @@ def dynamic( quantizer=None, multivector=None, ) + + +VectorIndexConfigCreate: TypeAlias = _VectorIndexConfigCreate