Skip to content

Vector example with @orama/plugin-embeddings not working #925

@diego-betto

Description

@diego-betto

Describe the bug

Hi,

it seems that the second example, the one using @orama/plugin-embeddings does not work as expected.

From what I can see:

  • the first import is missing insert and search
  • then the search throws an error
    file:///..../node_modules/@orama/orama/dist/esm/methods/search-vector.js:15
      const vectorIndex = orama.data.index.vectorIndexes[vector.property];
    
    TypeError: Cannot read properties of undefined (reading 'property')
    
    Maybe we need to add a check for vector is being defined here or use another import.

Also check the first example. It imports remove‘ and searchVector’ but doesn't use them. It's not a big deal, but I think it's better to remove them or add some code that uses them for better understanding.

Regards,
Diego

To Reproduce

Just try the example with @orama/plugin-embeddings

Expected behavior

To run without issues

Environment Info

OS: Ubuntu 24.04.2 LTS
Node: v22.14.0

Packages
    "@orama/orama": "^3.1.6",
    "@orama/plugin-embeddings": "^3.1.6",
    "@tensorflow/tfjs-node": "^4.22.0"

Affected areas

Initialization, Search

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions