Skip to content

Vector blob size does not match index's expected siz #20

@framirezt

Description

@framirezt

I've been trying out the vector similarity search but for some reason it returns this error:

Error parsing vector similarity query: query vector blob size (788) does not match index's expected size (3072).

The vector "dim" in the schema/index I set it to 768 since thats the length of the vectors I am creating. The vector I try to search with is 768 in length, I am not sure why it says its 788, and the expected size is 3072. Did I miss anything?

Here is a snippet of my implementation:

\\\\\\\\\\\\\\\\\\\\\\\\     USER SCHEMA    \\\\\\\\\\\\\\\\\\\\\\\\\\\
const userSchema = client.schema({
  firstName: "string",
  lastName: "string",
  age: "number",
  verified: "boolean",
  location: "point",
  skills: "array",
  personalStatement: { type: "text", phonetic: "dm:es" },
  vectorEmbedding: {
    type: "vector",
    index: true,
    algorithm: "HNSW",
    dim: 768,
    distance: "COSINE",
    vecType: "FLOAT32",
  },
});

// Create the interface
const User = client.model("User", userSchema);
\\\\\\\\\\\\\\\\\\\\\\\\\\     SEARCH VECTORS   \\\\\\\\\\\\\\\\\\\\\  
export const searchVectors = async (req, res) => {

// vectors is the text entered by the user converted to a 768 vector 

 const user = await User.search()
    .where("vectorEmbedding")
    .eq((vector) => vector.knn().from(vectors).return(8))
    .returnAll();

  res.send(user);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions