Anush008 / fastembed-js

Library to generate vector embeddings in NodeJS
https://www.npmjs.com/package/fastembed/
MIT License
64 stars 5 forks source link

Array instead of object #10

Closed msj121 closed 9 months ago

msj121 commented 9 months ago

Is there a way you can return a vector as an array instead of an object.

ie: instead of {"0":0.9823,"1":0.234....} I'd like [0.9823,0.234...]

Perhaps an argument or utility function? Is that at all possible currently?

Anush008 commented 9 months ago

Should be an array already. If not, from your example, you can just do Object.values(data) to get it.

msj121 commented 9 months ago

Just to be sure, I am using the code like this let vector = await this.embedder.queryEmbed(query);

Yah, currently I am using Object.values just seemed a little inefficient for the server (since it loops through each value), but I hear you. Thanks. Great package btw.