weaviate / weaviate

Weaviate is an open-source vector database that stores both objects and vectors, allowing for the combination of vector search with structured filtering with the fault tolerance and scalability of a cloud-native database​.
https://weaviate.io/developers/weaviate/
BSD 3-Clause "New" or "Revised" License
11.26k stars 785 forks source link

Weaviate vectorizer `ref2vec-centroid` not computing vector after PUT on object references #3185

Closed danielknode closed 1 week ago

danielknode commented 1 year ago

Weaviate version: 1.19.9 (WCS)

I have configured class Foo to use the ref2vec-centroid vectorizer module on the property belongsTo which cross-references Bar:

[
  {
    "class": "Foo",
    "vectorizer": "ref2vec-centroid",
    "moduleConfig": {
      "ref2vec-centroid": {
        "referenceProperties": ["belongsTo"],
        "method": "mean"
      }
    },
    "properties": [
      {
        "name": "belongsTo",
        "dataType": ["Bar"],
      },
    ]
  },
  {
    "class": "Bar",
    "vectorizer": "text2vec-openai",
    "moduleConfig": {
      "text2vec-openai": {
        "model": "ada",
        "modelVersion": "002",
        "type": "text"
      }
    },
    "properties": [...]
  }
]

I created a Foo and Bar objects (without reference) and verified the vector exists on Bar object. Then I run the following to update the reference from Foo to Bar which calls PUT on object references endpoint:

import weaviate

client = # create Weaviate client

foo_uuid = # create Foo object
bar_uuid = # create Bar object

client.data_object.reference.update(
    from_class_name="Foo",
    from_uuid=foo_uuid,
    from_property_name="belongsTo",
    to_class_names="Bar",
    to_uuids=[bar_uuid]
)

According to the ref2vec-centroid module documentation I would expect the Foo objects vector to now be computed, but a Get GQL query to retrieve vector for the object returns null as the vector.

AbhiPawar5 commented 1 year ago

Hi @danielweb3, thanks for raising this issue. I did try similar approach and could not see vectors!

Please find the docker compose YML if that's helpful:

version: '3.4'
services:
  weaviate:
    image: semitechnologies/weaviate:1.20.0
    restart: on-failure:0
    ports:
     - "8081:8080"
    environment:
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      ENABLE_MODULES: 'ref2vec-centroid, text2vec-transformers'
      TRANSFORMERS_INFERENCE_API: http://t2v-transformers:8080

  t2v-transformers:
    image: semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2-latest
    environment:
      ENABLE_CUDA: 0

Thanks.

dirkkul commented 1 week ago

I think this is a duplicate of https://github.com/weaviate/weaviate/issues/2654