Embeddings with Ollama

Harry · 13 Sep 2026 · 2 views

Why Embeddings

Embedding models turn text into vectors for similarity search and RAG. Ollama runs embedding models locally, so your indexing stays private and free.

Pull an Embedding Model

ollama pull nomic-embed-text

Embed via the API

curl http://localhost:11434/api/embed 
  -d '{"model": "nomic-embed-text", "input": "Vector databases store embeddings"}'

Embeddings in Python

import ollama

vec = ollama.embed(model="nomic-embed-text", input="Ollama runs locally")
print(len(vec["embeddings"][0]))   # 768

The vector feeds directly into ChromaDB, FAISS or pgvector for semantic search.

Build a Local RAG

Combine an embedding model for indexing with a chat model for answers, all inside Ollama, and your whole pipeline never touches the cloud.

Key Points

  • nomic-embed-text gives 768-D local embeddings.
  • The /api/embed endpoint returns vectors.
  • Feed embeddings into any vector store.
  • Pair embeddings plus a chat model for private RAG.
Share this post:

Comments (0)

Please login or register to comment.