Failed to create collection with vectorizers using demo code in nodejs

Environment: free cloud sandbox instance on Weaviate Cloud (WCD)
Code language: nodejs (v18.20.4)
Version: weaviate-client (v3.1.5)
Code:

const client = await weaviate.connectToWeaviateCloud(
  clusterUrl,
  {
    authCredentials: new weaviate.ApiKey(apiKeyAdmin),
    headers: {
      'X-OpenAI-Api-Key': openaiApiKey
    }
  }
)

await client.collections.create({
    name: testCollectionName,
    vectorizers: [
      weaviate.configure.vectorizer.text2VecOpenAI({
        name: 'question_vector',
        sourceProperties: ['question'],
        model: 'text-embedding-3-large',
        dimensions: 1024
      })
    ],
    properties: [
      { name: 'category', dataType: dataType.TEXT },
      { name: 'question', dataType: dataType.TEXT },
      { name: 'answer', dataType: dataType.TEXT },
    ]
})

It’s demo code from the document. But it can not create collection with vectorizer. (The result is : collection is created, but the Vectorizer is empty when view in console page)

Plus: The openaiApiKey provided is corrent.

I don’t know what’s wrong. Need help here. Thanks.

hi @Sandon !!

Welcome to our community :hugs:

This may be a bug in the console.

Apart from the vectorizer not being showed in the console, do you were you able to index and query your data as expected?

Hi, @DudaNogueira

I use the following code, but did not get vector showed (it is an empty object):

    for await (let item of questions.iterator({
      includeVector: true
    })) {
      console.log('item.vectors', item.vectors)
    }

Not only failed to create collection with named vector above. Also failed to create collection with default vector by code:

    await client.collections.create({
        name: testCollectionName,
        vectorizers: vectorizer.text2VecOpenAI(),
        properties: [
          { name: 'category', dataType: dataType.TEXT },
          { name: 'question', dataType: dataType.TEXT },
          { name: 'answer', dataType: dataType.TEXT },
        ]
      })

After using this code to create. Then use code:

    for await (let item of questions.iterator({
      includeVector: true
    })) {
      console.log('item.vectors', item.vectors)
    }

to query vector data. Still get empty object.

hi @Sandon !

What is the error message you get?

here is a full working code for typescript:

import weaviate, { dataType, vectorizer, WeaviateClient } from 'weaviate-client';

async function runFullExample() {
  
  const client: WeaviateClient = await weaviate.connectToLocal(
  )
  console.log(await client.isReady());

  await client.collections.delete("Test")

  await client.collections.create({
    name: "Test",
    vectorizers: vectorizer.text2VecOpenAI(),
    properties: [
      { name: 'category', dataType: dataType.TEXT },
      { name: 'question', dataType: dataType.TEXT },
      { name: 'answer', dataType: dataType.TEXT },
    ]
  })

  const collection = client.collections.get("Test")
  await collection.data.insert({
    "category": "cat1",
    "question": "q1",
    "answer": "a1"
  })

  const obj = (await collection.query.fetchObjects({limit:1, includeVector:true})).objects[0]
  console.log(obj.vectors)
  
}

runFullExample();

Let me know if this helps!