Nomic Embed is the most-pulled embedding model in the Ollama library: a small 137M-parameter model with 768 dimensions and an 8,192-token input limit. Embeddings turn text into numbers so you can search by meaning instead of by keyword. This guide pulls it, embeds two short texts, and shows how to tell which one is closer to a query.
Before you start
- Ollama installed and running.
- About 1 GB of free disk for the model.
- A terminal, and curl or Python for the API call.
Pull the model
Download the embedding model:
ollama pull nomic-embed-text
Embedding models do not chat: they only answer the embeddings endpoint.
Embed a query and two documents
Call the embed endpoint once for the query and once for each document. The endpoint is http://localhost:11434/api/embed and the body names the model and the input text. Nomic’s model expects the prefixes search_query: on queries and search_document: on documents.
curl http://localhost:11434/api/embed -d '{"model": "nomic-embed-text", "input": "search_query: how do I reset my router"}'
Compare the vectors
Each reply carries a list of 768 numbers. Compare them with cosine similarity: the document whose vector is closest to the query vector is the best match. A short Python script with the requests library can do the comparison in a few lines.
Worked example
Sample texts:
| Text | Role |
|---|---|
| how do I reset my router | Query |
| Press the small reset button on the back of the router for ten seconds. | Document A |
| The best pasta sauce uses fresh tomatoes and basil. | Document B |
Document A should score much closer to the query than Document B. If B wins, the prefixes or the model choice are wrong.
Expected result
UNTESTED in this guide: no API call was run while writing it. The expected result is that the embed endpoint returns a 768-number vector for each text, and Document A scores closer to the query than Document B.
Limitations
Embedding quality depends on chunking: a whole book in one call is truncated at the model’s input limit. Nomic Embed is English-first for retrieval quality; other languages need a multilingual model. Vectors from one model cannot be compared with vectors from another.
