Struggling to add custom vectors to weaviate in typescript

Description

I’m using a custom embedding model and want to store these vectors inside Weaviate and use the nearVector function to get the top N matches. I’m able to store the properties in Weaviate, but I can’t seem to store the vector values properly. What am I missing here?

I’ve inited a collection called Posts:

await weaviate.collections.create({
  name: "Posts",
  properties: [
    {
      name: "userId",
      dataType: weaviate.configure.dataType.TEXT,
      skipVectorisation: true,
      indexFilterable: true,
      indexSearchable: true,
    },
    {
      name: "postTitleAndText",
      dataType: weaviate.configure.dataType.TEXT,
      vectorizePropertyName: false,
      tokenization: "lowercase",
    },
    {
      name: "response",
      dataType: weaviate.configure.dataType.TEXT,
      skipVectorisation: true,
    },
  ],
  vectorizer: weaviate.configure.vectorizer.none(),
  vectorIndex: weaviate.configure.vectorIndex.hnsw({
    distanceMetric: "cosine",
  }),
})

Then in a separate function, in a for loop, I push objects in the following form to insertMany into my collection.

weaviatePosts.push({
      properties: {
        userId: uuid,
        postTitleAndText,
        response,
      },
      vectors: embeddings[index].embedding,
    });

const postsCollection = this.client.collections.get("Posts");
return await postsCollection.data.insertMany(weaviatePosts);

This step succeeds (uuid is created for each object), but if I try to view the object, there is no vector associated with it:

      const myCollection = weaviate.collections.get("Posts");

      for await (let item of myCollection.iterator({
        includeVector: true,
      })) {
        console.log("item", item);
      }

logs something like:

{
    properties: {
         userId: "something",
         ....
    }
    references: undefined,
    uuid: 'uuid string here',
    vectors: {}
}

Running a nearVector query with another embedding always returns an empty array. What am I doing wrong here? Thanks!

HI @potatopie !!

Welcome to our community :hugs:

Have you seen this example?

I believe the issue is that your vector must be in a vector property, not vectors

here an example:

const data = [
    {
      properties: {
        title: 'First Object',
        foo: 99,
      },
      vector: [0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
    },
    {
      properties: {
        title: 'Second Object',
        foo: 77,
      },
      vector: [0.2, 0.3, 0.4, 0.5, 0.6, 0.7],
    },
    {
      properties: {
        title: 'Third Object',
        foo: 55,
      },
      vector: [0.3, 0.1, -0.1, -0.3, -0.5, -0.7],
    },
    {
      properties: {
        title: 'Fourth Object',
        foo: 33,
      },
      vector: [0.4, 0.41, 0.42, 0.43, 0.44, 0.45],
    },
    {
      properties: {
        title: 'Fifth Object',
        foo: 11,
      },
      vector: [0.5, 0.5, 0, 0, 0, 0],
    },
  ];