| 12345678910111213 |
- import faiss
- from remote_model import RemoteBGEModel
- import numpy as np
- model = RemoteBGEModel()
- embedding = np.array(model.encode(["hello world"]), dtype=np.float32)
- db = faiss.IndexFlatIP(embedding[0].shape[0])
- db.add(embedding)
- dis, idx =db.search(embedding, 5)
- print(dis, idx)
|