Stevenic / vectra

Vectra is a local vector database for Node.js with features similar to pinecone but built using local files.
MIT License
321 stars 29 forks source link

NaN returned for score in query #14

Closed cawood402 closed 9 months ago

cawood402 commented 9 months ago

Firstly, thank you for this library. The concept is really great and useful.

I'm trying to implement the sample code given in the NPM page but it is not returning any scores. Just NaN.

I had to change the embeddings call for the latest OpenAI library. The new code is: const embedding = await openai.embeddings.create({ 'model': 'text-embedding-ada-002', 'input': encoded_line, })

Is this the issue? Do you know what could be causing the NaN issue?

cawood402 commented 9 months ago

I found the problem. I needed to get the vector from the response. I was using embedding from the line about. I needed embedding.data[0].embedding.