weaviate.collections package
- class weaviate.collections.Collection(connection: ConnectionV4, name: str, validate_arguments: bool, consistency_level: ConsistencyLevel | None = None, tenant: str | None = None, properties: Type[Properties] | None = None, references: Type[References] | None = None)[source]
Bases:
_CollectionBase
,Generic
[Properties
,References
]The collection class is the main entry point for interacting with a collection in Weaviate.
This class is returned by the client.collections.create and client.collections.get methods. It provides access to all the methods available to you when interacting with a collection in Weaviate.
You should not need to instantiate this class yourself but it may be useful to import this as a type when performing type hinting of functions that depend on a collection object.
- Attributes:
- aggregate
This namespace includes all the querying methods available to you when using Weaviate’s standard aggregation capabilities.
- aggregate_group_by
This namespace includes all the aggregate methods available to you when using Weaviate’s aggregation group-by capabilities.
- config
This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate.
- data
This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate.
- generate
This namespace includes all the querying methods available to you when using Weaviate’s generative capabilities.
- query_group_by
This namespace includes all the querying methods available to you when using Weaviate’s querying group-by capabilities.
- query
This namespace includes all the querying methods available to you when using Weaviate’s standard query capabilities.
- tenants
This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate.
- aggregate
This namespace includes all the querying methods available to you when using Weaviate’s standard aggregation capabilities.
- backup
This namespace includes all the backup methods available to you when backing up a collection in Weaviate.
- batch
This namespace contains all the functionality to upload data in batches to Weaviate for this specific collection.
- config
This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate.
- data
This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate.
- generate
This namespace includes all the querying methods available to you when using Weaviate’s generative capabilities.
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Literal[None] = None) _ObjectIterator[Properties, References] [source]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Sequence[_QueryReference | _QueryReferenceMultiTarget] | _QueryReference | _QueryReferenceMultiTarget) _ObjectIterator[Properties, CrossReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Type[TReferences]) _ObjectIterator[Properties, TReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Literal[None] = None) _ObjectIterator[TProperties, References]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Sequence[_QueryReference | _QueryReferenceMultiTarget] | _QueryReference | _QueryReferenceMultiTarget) _ObjectIterator[TProperties, CrossReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Type[TReferences]) _ObjectIterator[TProperties, TReferences]
Use this method to return an iterator over the objects in the collection.
This iterator keeps a record of the last object that it returned to be used in each subsequent call to Weaviate. Once the collection is exhausted, the iterator exits.
If return_properties is not provided, all the properties of each object will be requested from Weaviate except for its vector as this is an expensive operation. Specify include_vector to request the vector back as well. In addition, if return_references=None then none of the references are returned. Use wvc.QueryReference to specify which references to return.
- Arguments:
- include_vector
Whether to include the vector in the metadata of the returned objects.
- return_metadata
The metadata to return with each object.
- return_properties
The properties to return with each object.
- return_references
The references to return with each object.
- Raises:
- weaviate.exceptions.WeaviateGRPCQueryError:
If the request to the Weaviate server fails.
- query
This namespace includes all the querying methods available to you when using Weaviate’s standard query capabilities.
- tenants
This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate.
- with_consistency_level(consistency_level: ConsistencyLevel | None = None) Collection[Properties, References] [source]
Use this method to return a collection object specific to a single consistency level.
If replication is not configured for this collection then Weaviate will throw an error.
This method does not send a request to Weaviate. It only returns a new collection object that is specific to the consistency level you specify.
- Arguments:
- consistency_level
The consistency level to use.
- with_tenant(tenant: str | Tenant | None = None) Collection[Properties, References] [source]
Use this method to return a collection object specific to a single tenant.
If multi-tenancy is not configured for this collection then Weaviate will throw an error.
This method does not send a request to Weaviate. It only returns a new collection object that is specific to the tenant you specify.
- Arguments:
- tenant
The tenant to use. Can be str or wvc.tenants.Tenant.
Subpackages
- weaviate.collections.aggregations package
- Submodules
- weaviate.collections.aggregations.base module
- weaviate.collections.aggregations.near_image module
- weaviate.collections.aggregations.near_object module
- weaviate.collections.aggregations.near_text module
- weaviate.collections.aggregations.near_vector module
- weaviate.collections.aggregations.over_all module
- weaviate.collections.batch package
- weaviate.collections.classes package
- Submodules
- weaviate.collections.classes.aggregate module
- weaviate.collections.classes.batch module
- weaviate.collections.classes.config module
BM25Config
BQConfig
CollectionConfig
CollectionConfigSimple
Configure
ConsistencyLevel
DataType
DataType.BLOB
DataType.BOOL
DataType.BOOL_ARRAY
DataType.DATE
DataType.DATE_ARRAY
DataType.GEO_COORDINATES
DataType.INT
DataType.INT_ARRAY
DataType.NUMBER
DataType.NUMBER_ARRAY
DataType.OBJECT
DataType.OBJECT_ARRAY
DataType.PHONE_NUMBER
DataType.TEXT
DataType.TEXT_ARRAY
DataType.UUID
DataType.UUID_ARRAY
GenerativeConfig
GenerativeSearches
InvertedIndexConfig
Multi2VecField
MultiTenancyConfig
NestedProperty
PQConfig
PQEncoderConfig
PQEncoderDistribution
PQEncoderType
Property
PropertyConfig
PropertyVectorizerConfig
Reconfigure
ReferenceProperty
ReferencePropertyConfig
ReplicationConfig
RerankerConfig
Rerankers
ShardStatus
ShardingConfig
StopwordsConfig
StopwordsPreset
Tokenization
VectorDistances
VectorIndexConfigFlat
VectorIndexConfigHNSW
VectorIndexType
VectorizerConfig
Vectorizers
Vectorizers.IMG2VEC_NEURAL
Vectorizers.MULTI2VEC_BIND
Vectorizers.MULTI2VEC_CLIP
Vectorizers.NONE
Vectorizers.REF2VEC_CENTROID
Vectorizers.TEXT2VEC_AWS
Vectorizers.TEXT2VEC_COHERE
Vectorizers.TEXT2VEC_CONTEXTIONARY
Vectorizers.TEXT2VEC_GPT4ALL
Vectorizers.TEXT2VEC_HUGGINGFACE
Vectorizers.TEXT2VEC_JINAAI
Vectorizers.TEXT2VEC_OPENAI
Vectorizers.TEXT2VEC_PALM
Vectorizers.TEXT2VEC_TRANSFORMERS
- weaviate.collections.classes.config_methods module
- weaviate.collections.classes.data module
- weaviate.collections.classes.filters module
- weaviate.collections.classes.grpc module
- weaviate.collections.classes.internal module
CrossReference
CrossReferenceAnnotation
GenerativeGroup
GenerativeGroupByReturn
GenerativeObject
GenerativeReturn
Group
GroupByMetadataReturn
GroupByObject
GroupByReturn
GroupedObject
MetadataReturn
MetadataSingleObjectReturn
Object
ObjectSingleReturn
QueryReturn
ReferenceInput
ReferenceInputs
ReferenceToMulti
- weaviate.collections.classes.orm module
- weaviate.collections.classes.tenants module
- weaviate.collections.classes.types module
- weaviate.collections.grpc package
- weaviate.collections.queries package
- Submodules
- weaviate.collections.queries.base module
- weaviate.collections.queries.bm25 module
- weaviate.collections.queries.fetch_objects module
- weaviate.collections.queries.hybrid module
- weaviate.collections.queries.near_audio module
- weaviate.collections.queries.near_image module
- weaviate.collections.queries.near_object module
- weaviate.collections.queries.near_text module
- weaviate.collections.queries.near_vector module
- weaviate.collections.queries.near_video module
Submodules
weaviate.collections.aggregate module
weaviate.collections.base module
weaviate.collections.collection module
- class weaviate.collections.collection.Collection(connection: ConnectionV4, name: str, validate_arguments: bool, consistency_level: ConsistencyLevel | None = None, tenant: str | None = None, properties: Type[Properties] | None = None, references: Type[References] | None = None)[source]
Bases:
_CollectionBase
,Generic
[Properties
,References
]The collection class is the main entry point for interacting with a collection in Weaviate.
This class is returned by the client.collections.create and client.collections.get methods. It provides access to all the methods available to you when interacting with a collection in Weaviate.
You should not need to instantiate this class yourself but it may be useful to import this as a type when performing type hinting of functions that depend on a collection object.
- Attributes:
- aggregate
This namespace includes all the querying methods available to you when using Weaviate’s standard aggregation capabilities.
- aggregate_group_by
This namespace includes all the aggregate methods available to you when using Weaviate’s aggregation group-by capabilities.
- config
This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate.
- data
This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate.
- generate
This namespace includes all the querying methods available to you when using Weaviate’s generative capabilities.
- query_group_by
This namespace includes all the querying methods available to you when using Weaviate’s querying group-by capabilities.
- query
This namespace includes all the querying methods available to you when using Weaviate’s standard query capabilities.
- tenants
This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate.
- aggregate
This namespace includes all the querying methods available to you when using Weaviate’s standard aggregation capabilities.
- backup
This namespace includes all the backup methods available to you when backing up a collection in Weaviate.
- batch
This namespace contains all the functionality to upload data in batches to Weaviate for this specific collection.
- config
This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate.
- data
This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate.
- generate
This namespace includes all the querying methods available to you when using Weaviate’s generative capabilities.
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Literal[None] = None) _ObjectIterator[Properties, References] [source]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Sequence[_QueryReference | _QueryReferenceMultiTarget] | _QueryReference | _QueryReferenceMultiTarget) _ObjectIterator[Properties, CrossReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Sequence[str | QueryNested] | str | QueryNested | None = None, return_references: Type[TReferences]) _ObjectIterator[Properties, TReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Literal[None] = None) _ObjectIterator[TProperties, References]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Sequence[_QueryReference | _QueryReferenceMultiTarget] | _QueryReference | _QueryReferenceMultiTarget) _ObjectIterator[TProperties, CrossReferences]
- iterator(include_vector: bool = False, return_metadata: List[Literal['creation_time', 'last_update_time', 'distance', 'certainty', 'score', 'explain_score', 'is_consistent']] | MetadataQuery | None = None, *, return_properties: Type[TProperties], return_references: Type[TReferences]) _ObjectIterator[TProperties, TReferences]
Use this method to return an iterator over the objects in the collection.
This iterator keeps a record of the last object that it returned to be used in each subsequent call to Weaviate. Once the collection is exhausted, the iterator exits.
If return_properties is not provided, all the properties of each object will be requested from Weaviate except for its vector as this is an expensive operation. Specify include_vector to request the vector back as well. In addition, if return_references=None then none of the references are returned. Use wvc.QueryReference to specify which references to return.
- Arguments:
- include_vector
Whether to include the vector in the metadata of the returned objects.
- return_metadata
The metadata to return with each object.
- return_properties
The properties to return with each object.
- return_references
The references to return with each object.
- Raises:
- weaviate.exceptions.WeaviateGRPCQueryError:
If the request to the Weaviate server fails.
- query
This namespace includes all the querying methods available to you when using Weaviate’s standard query capabilities.
- tenants
This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate.
- with_consistency_level(consistency_level: ConsistencyLevel | None = None) Collection[Properties, References] [source]
Use this method to return a collection object specific to a single consistency level.
If replication is not configured for this collection then Weaviate will throw an error.
This method does not send a request to Weaviate. It only returns a new collection object that is specific to the consistency level you specify.
- Arguments:
- consistency_level
The consistency level to use.
- with_tenant(tenant: str | Tenant | None = None) Collection[Properties, References] [source]
Use this method to return a collection object specific to a single tenant.
If multi-tenancy is not configured for this collection then Weaviate will throw an error.
This method does not send a request to Weaviate. It only returns a new collection object that is specific to the tenant you specify.
- Arguments:
- tenant
The tenant to use. Can be str or wvc.tenants.Tenant.