hi!
You never defined the named vectors to begin with
Check here some nice academy we have about this:
this is how your collection should look like:
import weaviate
from weaviate import classes as wvc
client = weaviate.connect_to_local()
from weaviate import classes as wvc
client.collections.delete("MyCollection")
client.collections.create(
name="MyCollection",
description="collection_1",
replication_config=wvc.config.Configure.replication(
factor=1
),
vectorizer_config=[
wvc.config.Configure.NamedVectors.none(
name="title",
),
wvc.config.Configure.NamedVectors.none(
name="review",
),
wvc.config.Configure.NamedVectors.none(
name="detail",
),
],
properties=[
wvc.config.Property(name="product_no", data_type=wvc.config.DataType.NUMBER),
wvc.config.Property(name="original_review", data_type=wvc.config.DataType.TEXT,
tokenization=wvc.config.Tokenization.WORD),
wvc.config.Property(name="title", data_type=wvc.config.DataType.TEXT, skipVectorisation=True),
wvc.config.Property(name="review", data_type=wvc.config.DataType.TEXT, skipVectorisation=True),
wvc.config.Property(name="detail", data_type=wvc.config.DataType.TEXT, skipVectorisation=True),
]
)
Now inserting some data:
collection = client.collections.get("MyCollection")
collection.data.insert({
"title": "This is a title",
"detail": "some details",
"review": "this seems good"
},
vector={
"title": [1],
"review": [1, 2],
"detail": [1, 2, 3]
}
)
and now retrieving it:
collection.query.fetch_objects(include_vector=True).objects[0].vector
and this should be the output:
{‘detail’: [1.0, 2.0, 3.0], ‘review’: [1.0, 2.0], ‘title’: [1.0]}
Let me know if this helps!!
Thanks!