Quantcast
Channel: Active questions tagged mongodb-atlas - Stack Overflow
Viewing all articles
Browse latest Browse all 271

how to calculate embedding using openAI api for MongoDB vector search

$
0
0

I am trying to follow the example at https://www.mongodb.com/docs/atlas/atlas-vector-search/tutorials/vector-search-tutorial/

It mentioned that the search vector was based on string "historical heist" using openAI 'text-embedding-ada-002' embeddings. However, when I tried to validate this with my own openAI key, I got different results.

why?

curl https://api.openai.com/v1/embeddings \  -H "Content-Type: application/json" \  -H "Authorization: Bearer sk-xxxxx" \  -d '{"input": "historical heist","model": "text-embedding-ada-002","encoding_format": "float"  }'

my results are like

"data": [     {108      "object": "embedding","index": 0,19      "embedding": [8        -0.02273331,97         -0.027646419,          0.0030520316, 3        -0.033631727,1        -0.026207773,4  0:00:01 --:-        0.0016854883,-:--  0:0        -0.017983066,0:0        0.006311038,1         -0.0013012275,201        -0.024823416,54        0.015227924,        0.005751188,        0.0004003777,        -0.008095773,

The example python code has

'queryVector': [-0.020156775, -0.024996493, 0.010778184, ....

Viewing all articles
Browse latest Browse all 271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>