New Tool Radar

Local AI

Get Text Embeddings from Ollama with the Embeddings API

Call the Ollama embeddings endpoint with the nomic-embed-text model and read the returned vector for local search.

Schematic with three steps: Pull the embedding model; Send an embeddings request; Check the vector.

Embeddings turn text into lists of numbers that capture meaning, so similar texts sit close together. Ollama serves the nomic-embed-text model through its /api/embeddings endpoint, which is the starting point for local semantic search.

What you need

  • Ollama 0.1.26 or newer, which the embedding model requires
  • curl installed
  • A terminal on the same machine

Step 1: Pull the embedding model

Run ollama pull nomic-embed-text. This is an embeddings-only model, so ollama run does not apply to it; it exists to serve the embeddings endpoint.

Step 2: Send an embeddings request

Run: curl http://localhost:11434/api/embeddings -d ‘{model: nomic-embed-text, prompt: The cat sits on the mat}’. The reply JSON holds an embedding field with the vector as a list of numbers.

Step 3: Check the vector

Count the numbers in the embedding array to confirm a full vector came back, and embed a second, related sentence to compare. Similar sentences should produce vectors that are closer together than unrelated ones.

Worked example: embed one sentence

The table below is a synthetic example. The endpoint and the model requirement come from the Ollama docs; the sentence is illustrative.

Step Command or value Expected result
Pull ollama pull nomic-embed-text success
Request POST /api/embeddings HTTP 200
Reply embedding field A list of numbers

Expected result (UNTESTED). the embeddings call returns HTTP 200 and an embedding array of numbers for the sentence. This check was not run live; the endpoint and model requirement come from the cited Ollama docs.

Limits

  • nomic-embed-text needs Ollama 0.1.26 or newer.
  • The model is embeddings-only and cannot chat.
  • The vector length is fixed by the model; do not mix models in one index.
  • Embeddings are computed locally; no text leaves the machine.

Sources

See all