My collections:
"Short",
properties=[
Property(
name=ShortProps.ID.value,
data_type=DataType.INT,
description="Unique identifier for the short.",
skip_vectorization=True,
),
Property(
name=ShortProps.HASH_NAME.value,
data_type=DataType.TEXT,
description="Unique content hash name for the short.",
skip_vectorization=True,
),
Property(
name=ShortProps.DESCRIPTION.value,
data_type=DataType.TEXT,
description="Short description of the content.",
),
Property(
name=ShortProps.CATEGORY.value,
data_type=DataType.TEXT,
description="Category of the short.",
),
Property(
name=ShortProps.CONTENT.value,
data_type=DataType.BLOB,
description="Content of the short (e.g., video, image)."
),
],
vectorizer_config=[
# Set a named vector
Configure.NamedVectors.multi2vec_bind(
name="shorts_vec",
text_fields=[
Multi2VecField(name=ShortProps.DESCRIPTION.value, weight=0.3),
Multi2VecField(name=ShortProps.CATEGORY.value, weight=0.2),
],
# video_fields=[
# Multi2VecField(name=ShortProps.CONTENT.value, weight=0.5),
# ],
),
],
)
await cls.client.collections.create(
"UserInteractions",
properties=[
Property(
name=UserInteractionsProps.ID.value,
data_type=DataType.INT,
description="Unique identifier for the user."
),
],
references=[
ReferenceProperty(
name=UserInteractionsProps.LIKED_SHORTS.value,
target_collection="Short",
description="Short which liked by current user",
),
],
vectorizer_config=[
Configure.NamedVectors.ref2vec_centroid(
name="liked_vector",
reference_properties=[
UserInteractionsProps.LIKED_SHORTS.value,
],
),
],
)
I tried add cross-references like this:
async def create_interaction(
self,
user_interactions_uuid: UUID,
short_uuid: UUID,
interaction_type: InteractionType,
) -> None:
await self.collection.data.reference_add(
from_uuid=user_interactions_uuid,
from_property=interaction_type_property[interaction_type.value],
to=short_uuid
)
but got object with empty vector:
Object(uuid=_WeaviateUUIDInt('ede63ad5-ae6b-4041-be34-1db9864177c7'), metadata=MetadataReturn(creation_time=None, last_update_time=None, distance=None, certainty=None, score=None, explain_score=None, is_consistent=None, rerank_score=None), properties={'object_id': 2}, references={'liked_shorts': <weaviate.collections.classes.internal._CrossReference object at 0x75f4bf33ae10>}, vector={'liked_vector': []}, collection='UserInteractions')