The Ollama CLI can generate embeddings directly from a prompt or piped text when the selected model is built for embeddings. This is the fastest way to test vector output before wiring the same model into an API or database workflow.

Embedding output is a JSON array rather than prose. The vector length depends on the model, so the same model should be used for both indexing documents and embedding search queries.

The local campaign validated embeddings with all-minilm:latest after it appeared in the model store during worker validation. Replace it with embeddinggemma or another current embedding model when that is the standard for the project.

Steps to generate embeddings with Ollama:

  1. Pull an embedding model.
    $ ollama pull all-minilm
    success
  2. Generate an embedding from a short string.
    $ ollama run all-minilm "Hello world"
    [-0.034513,0.018204,0.012447,##### snipped #####]

    Embedding vectors are long; trim only the displayed sample, not the real application value.

  3. Pipe text into the embedding model when the input comes from another command.
    $ printf '%s\n' 'The quick brown fox jumps over the lazy dog.' | ollama run all-minilm
    [-0.012401,0.041902,##### snipped #####]
  4. Use the API endpoint when the caller is an application.
    $ curl -s http://localhost:11434/api/embed -d '{"model":"all-minilm:latest","input":"Hello world"}'
    {"model":"all-minilm:latest","embeddings":[[##### snipped #####]]}
  5. Confirm the model remains installed for later indexing jobs.
    $ ollama list
    NAME                 ID              SIZE     MODIFIED
    all-minilm:latest    1b226e2802db    25 MB    just now