Text2vec-gpt4all: "{'error': [{'message': 'class **** not present'}]}"

Hello

I have a weaviate server running on one container and a text2vec-gpt4all vectorizer running on another. They are successfully linked via a docker network and are running, however whenever I go to add objects to collection ****, the vectorizer returns this error and no documents are added. I have verified the collection exists and the name is correct. What makes this weird is that I have autoschema enabled, so even if weaviate thinks it does not exist, shouldn’t a collection be created?

---
version: '3.4'
services:
  weaviate:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8080'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.24.6
    ports:
    - 8080:8080
    volumes:
    - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    networks:
      - dev-t2v
      - default
    environment:
      GPT4ALL_INFERENCE_API: 'http://text2vec-gpt4all:8080'
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-gpt4all'
      ENABLE_MODULES: 'text2vec-gpt4all'
      CLUSTER_HOSTNAME: 'node1'
networks:
  default:
    external: false
  dev-t2v:
    external: true
volumes:
  weaviate_data:
...
version: '3.4'
services:
  text2vec-gpt4all:
    build:
      context: .
      dockerfile: Dockerfile
    security_opt:
    - seccomp:unconfined
    networks:
        - default
        - dev-t2v        
networks:
  default:
    external: false
  dev-t2v:
    external: true

Hi!

Auto Schema will not create the collection for you. It will create the properties, according to data being passed.

Can you paste the entire error code and some lines as context?

Where are you getting that error code from?

Also, please, provide the versions of server and client

Thanks!

Here is the setup that should work and connect properly. I have verified in the logs and using RESTful API that the vectorizer is recognized within weaviate as well as assigned to the “TEST” class.

version: '3.9'
services:
  # cpu optimized vectorizer
  t2v-gpt4all:
    image: cr.weaviate.io/semitechnologies/gpt4all-inference:all-MiniLM-L6-v2
    container_name: test_weaviate-t2v-gpt4all
    # overrides thread limit
    security_opt:
    - seccomp:unconfined
    env_file:
      - .env
    networks:
        - weaviate_net

  # database to interface/hold vectorized data
  weaviate-database:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8080'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.25.3
    container_name: test_weaviate-database
    ports:
    - 8075:8080
    - 50052:50051
    volumes:
    - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    networks:
        - weaviate_net    
    env_file:
      - .env
    depends_on:
      - t2v-gpt4all
    environment:
      GPT4ALL_INFERENCE_API: 'http://t2v-gpt4all:8080'
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-gpt4all'
      ENABLE_MODULES: 'text2vec-gpt4all'
      CLUSTER_HOSTNAME: 'node1'

Here is the code I am using to send a simple object to the TEST class:

from weaviate import Client

WEAVIATE_URL = "http://localhost:8075"
CLIENT = Client(WEAVIATE_URL, timeout_config=(10, 60))

# to create class if not already created
CLIENT.schema.create_class( schema = {
                                "class": "TEST",
                                "description": "A test class",
                                "vectorIndexType": "hnsw",
                                "vectorizer": "text2vec-gpt4all",
                                "moduleConfig": {
                                    "vectorizeClassName": False
                                },
                                "properties": [
                                    {
                                        "name": "noteText",
                                        "dataType": ["string"],
                                        "description": "test property"
                                    }
                                ]
                            })

uuid = CLIENT.data_object.create(
    class_name="TEST",
    data_object={
        "noteText": "some random test string"
    }
)

print(uuid)  # the return value is the object's UUID

And finally, here is the full error code I receive when trying to add the object:

weaviate.exceptions.UnexpectedStatusCodeError: Creating object! Unexpected status code: 500, with response body: {‘error’: [{‘message’: ‘no vectorizer found for class “TEST”’}]}

Hi!

Unfortunately gpt4all doesn’t run on my Mac :joy:

But ok, I have used a VPS.

Now, any reason you are using python client v3?

Here is a code in python client v4:

import weaviate
import os
from weaviate.classes.config import Configure, Property, DataType

client = weaviate.connect_to_custom(
    http_host="yourhost",
    http_port=8075,
    http_secure=False,
    grpc_host="yourhost",
    grpc_port=50052,
    grpc_secure=False
)
collection = client.collections.create(
    "Test",
    description="A test class",
    vectorizer_config=Configure.Vectorizer.text2vec_gpt4all(
        vectorize_collection_name=False
    ),
    properties=[
        Property(name="noteText", data_type=DataType.TEXT, description="test property")
    ]
)
# insert the data
collection.data.insert({"noteText": "This is a test"})

# query the data:
object = collection.query.fetch_objects(include_vector=True).objects[0]
print(object.properties)
print(object.vector)

Here is a nice guide on how to migrate from using the python client v3 to the python client v4:

I have also tried your python client v3 code, and got the same issues. So my advice is:

  • Just use python v4 client from the get go.
  • Create the collection using python v4 client, then keep using the python v3 client.

Did you now you can install python v4 package and still use the python v3 client?

so running:
pip install -U weaviate-client

will update your python client for Weaviate.

Let me know if this helps!