Embeddings + similarity search (Python + FAISS)
- Request embeddings from SynapsAI.
- Insert into FAISS (or whichever vector DB you use).
- Query by embedding similarity.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use SynapsAI embeddings with FAISS for similarity search
from synapsai import SynapsAI
import numpy as np
import faiss
client = SynapsAI()
texts = ["Alpha example", "Beta features", "Gamma release notes"]
embeddings = [client.embeddings.create(model="<YOUR_EMBEDDING_MODEL_ID>", input=t).data[0].embedding for t in texts]
d = len(embeddings[0])
index = faiss.IndexFlatL2(d)
index.add(np.array(embeddings).astype("float32"))
q_emb = client.embeddings.create(model="<YOUR_EMBEDDING_MODEL_ID>", input="Tell me about release features").data[0].embedding
D, I = index.search(np.array([q_emb]).astype("float32"), k=2)
print("Top indices:", I[0], "distances:", D[0])