Skip to content

feat: export private collection config types as public aliases#2049

Open
LijuanTang94 wants to merge 1 commit into
weaviate:mainfrom
LijuanTang94:fix/export-private-types-as-public
Open

feat: export private collection config types as public aliases#2049
LijuanTang94 wants to merge 1 commit into
weaviate:mainfrom
LijuanTang94:fix/export-private-types-as-public

Conversation

@LijuanTang94
Copy link
Copy Markdown

Summary

Closes #1994

Users who want to type-annotate parameters like generative_config, reranker_config, vector_index_config, etc. in collection.create() currently have to import private _-prefixed types. In pyright strict mode (reportPrivateUsage: error) this is flagged as an error.

This PR follows the exact same pattern as #1993 (FilterReturn) and adds public TypeAlias entries for the 8 affected types from collections/collections/executor.py:

Public alias Private type
GenerativeConfigCreate _GenerativeProvider
InvertedIndexConfigCreate _InvertedIndexConfigCreate
MultiTenancyConfigCreate _MultiTenancyConfigCreate
ObjectTTLConfigCreate _ObjectTTLConfigCreate
ReplicationConfigCreate _ReplicationConfigCreate
RerankerConfigCreate _RerankerProvider
ShardingConfigCreate _ShardingConfigCreate
VectorIndexConfigCreate _VectorIndexConfigCreate

All 8 aliases are re-exported from weaviate.classes.config.

Before

# pyright error: reportPrivateUsage
from weaviate.collections.classes.config import _GenerativeProvider

def my_helper(gen: Optional[_GenerativeProvider]) -> ...:
    ...

After

from weaviate.classes.config import GenerativeConfigCreate

def my_helper(gen: Optional[GenerativeConfigCreate]) -> ...:
    ...

Changes

  • weaviate/collections/classes/config.py — 6 new TypeAlias entries
  • weaviate/collections/classes/config_object_ttl.py — add TypeAlias import + 1 alias
  • weaviate/collections/classes/config_vector_index.py — add TypeAlias import + 1 alias
  • weaviate/classes/config.py — import and re-export all 8 aliases in __all__

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 weaviate#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 weaviate#1994
Copy link
Copy Markdown

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

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?

@LijuanTang94
Copy link
Copy Markdown
Author

LijuanTang94 commented May 31, 2026 via email

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.

Private types exposed in public method signatures

2 participants