Semantic search starts with embeddings: turn each note into a vector, turn the question into a vector, and compare them. LM Studio’s local server supports the embeddings endpoint, so you can generate those vectors locally without sending your notes anywhere. The guide quoted here says to load a dedicated embedding model — search for nomic-embed-text or bge-m3 in the model browser — start the server with that model active, and call the embeddings endpoint exactly as you would with the OpenAI API.
Related guide: How to Run an Embedding Model to Search Your Notes
Generate the vectors
from openai import OpenAI
client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")
resp = client.embeddings.create(model="nomic-ai/nomic-embed-text-v1.5-GGUF", input=["The lighthouse keeper trims the lamp.", "The baker kneads the dough."])
print(len(resp.data[0].embedding))
The model name must match the identifier shown in LM Studio. The linked guide notes that nomic-embed-text-v1.5 produces 768-dimension vectors — check the length your model returns rather than assuming it, because embedding models differ. Use the same model for the notes and the question: vectors from different models cannot be compared.
Search with them
Store one vector per note, then for a question compute its vector and rank the notes by similarity (cosine similarity is the usual measure). Test with questions you know the answer to: the note that answers it should rank first. If it does not, the embedding model may be the wrong one for your text, or the notes may need splitting into smaller pieces first.
Expected result. We checked the LM Studio docs for the OpenAI-like endpoints and the linked guides for the embeddings endpoint, the example models, and the 768-dimension figure for nomic-embed-text-v1.5. We did not run this software ourselves for this guide, so no output here is a recorded result; steps marked UNTESTED were checked against the sources below, not run.
Limits
An embedding model cannot chat, and a chat model used for embeddings gives poor vectors — keep the two jobs on two models. The code in this guide is from the sources and is UNTESTED on this machine; the model identifier will differ for your download. We did not run LM Studio.
Sources
- LM Studio docs — serve local models on OpenAI-like endpoints; Python SDK can embed content
- LM Studio guide — the local server supports the embeddings endpoint: load a dedicated embedding model such as nomic-embed-text or bge-m3, start the server with that model active, and call the embeddings endpoint exactly as with the OpenAI API
- Local vision model guide — the same LM Studio setup uses nomic-embed-text-v1.5 as the embedding model, producing 768-dimension vectors
Checked 2026-11-28.
