Ollama embeddings API and local RAG pipelines
Parent: Ollama deployment, cloud, security and operations · Published reference · snapshot 2026-10-14 · skill ollama-expert/references/ollama-ops-platform.md
↓ Facts as markdownall context files
Everything the scanned sources say about Ollama embeddings API and local RAG pipelines: 42 source-anchored units across 8 sources, grouped by facet.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- Embedding models are often used in retrieval-augmented generation (RAG) flows, both as part of indexing data as well as later retrieving it. For more detailed instructions, please see our RAG tutorials. Below, see how to index and retrieve data using the embeddings object we initialized above. In this example, we will index and retrieve a sample document in the InMemoryVectorStore. [source]
- In this section, you load an embedding model locally and generate vector embeddings by using data from the sample_airbnb database, which contains a collection called listingsAndReviews. [source]
How it works
- Ollama's reference RAG flow is embed documents with ollama.embed, store in a vector DB (ChromaDB in the blog), embed the question, retrieve nearest documents, and pass them with the question to a local generation model. The 2024 blog lists mxbai-embed-large (334M), nomic-embed-text (137M) and all-minilm (23M). [source]
How-to and procedures
Examples and snippets
- apiVersion: v1 kind: ConfigMap metadata: name: ollama-models labels: app: ollama data: models.txt: | llama3.1:8b mistral:7b codellama:13b nomic-embed-text:latest pull-script.sh: | #!/bin/sh [source]
Problems, failure modes and limitations
- Silent truncation hazard: with truncate defaulting to true, chunks longer than the effective context are cut without error. A downstream project reports nomic-embed-text effectively at about 2048 tokens by default and fixed it by sending options.num_ctx and capping batch/input size. [source]
- Optional /api/embed parameters are truncate (default true; if false, over-length input returns an error instead), dimensions, keep_alive and options (e.g. num_ctx). [source]
- If true, truncate inputs that exceed the context window. If false, returns an error. [source]
Facts and statements
- Vector length depends on the model (typically 384-1024). The dimensions parameter truncates output for models that support configurable sizes, e.g. qwen3-embedding:8b with dimensions=1024 in LangChain. [source]
- Vectors from /api/embed are L2-normalized, so cosine similarity (equivalently dot product) is the recommended metric; use the same embedding model for indexing and querying. [source]
- Frameworks wrap the API: LangChain's OllamaEmbeddings exposes embed_query for queries and embed_documents for indexing, usable with vector stores such as InMemoryVectorStore. [source]
- Ollama supports embedding models, making it possible to build retrieval augmented generation (RAG) applications that combine text prompts with existing documents or other data. [source]
- This example walks through building a retrieval augmented generation (RAG) application using Ollama and embedding models. [source]
- ollama.embed( model='mxbai-embed-large', input='Llamas are members of the camelid family', ) [source]
- for i, d in enumerate(documents): response = ollama.embed(model="mxbai-embed-large", input=d) embeddings = response["embeddings"] collection.add( ids=[str(i)], embeddings=embeddings, documents=[d] ) [source]
- response = ollama.embed( model="mxbai-embed-large", input=prompt ) results = collection.query( query_embeddings=[response["embeddings"]], n_results=1 ) data = results['documents'][0][0] [source]
- embeddings = OllamaEmbeddings( model="qwen3-embedding:8b", dimensions=1024, ) [source]
- This will help you get started with Ollama embedding models using LangChain. For detailed documentation on OllamaEmbeddings features and configuration options, please refer to the API reference. [source]
- Embeddings turn text into numeric vectors you can store in a vector database, search with cosine similarity, or use in RAG pipelines. The vector length depends on the model (typically 384–1024 dimensions). [source]
- * Use cosine similarity for most semantic search use cases. * Use the same embedding model for both indexing and querying. [source]
- queryPrefix and documentPrefix provide the task instructions required by nomic-embed-text. [source]
- Integrate with the OllamaEmbeddings embedding model using LangChain Python. [source]
- If your model supports configurable output dimensions (e.g., qwen3-embedding), you can specify them via the dimensions parameter: [source]
- WARN Voyage API credential files not configured. Voyage models will be unavailable. Keyless OPENAI_COMPATIBLE models (Ollama/vLLM/TEI) remain active. INFO Reading embedding configuration from on-disk catalog WARN Skipping Voyage embedding model 'voyage-4-large': no Voyage API credentials configured INFO Initialized auto-embedding with 2 models [source]
- curl http://localhost:11434/api/embed -d '{ "model": "embeddinggemma", "input": "Why is the sky blue?" }' [source]
- curl -X POST http://localhost:11434/api/embed \ -H "Content-Type: application/json" \ -d '{ "model": "embeddinggemma", "input": "The quick brown fox jumps over the lazy dog." }' [source]
- curl -X POST http://localhost:11434/api/embed \ -H "Content-Type: application/json" \ -d '{ "model": "embeddinggemma", "input": [ "First sentence", "Second sentence", "Third sentence" ] }' [source]
- curl -s http://localhost:11434/v1/embeddings \ -H "Content-Type: application/json" \ -d '{ "model": "nomic-embed-text", "input": ["hello"] }' [source]
- configs: - modelName: nomic-embed-text embeddingProvider: OPENAI_COMPATIBLE config: providerEndpoint: http://localhost:11434/v1/embeddings [source]
- The /api/embed endpoint returns L2‑normalized (unit‑length) vectors. [source]
- I need a local LLM model to generate embeddings from lyrics. To avoid relying on external services, I will use Ollama with the nomic-embed-text model, which I install locally: [source]
- What are embedding models? [source]
- Embedding models are models that are trained specifically to generate vector embeddings: long arrays of numbers that represent semantic meaning for a given sequence of text: [source]
- More embedding model architectures: support for ColBERT, RoBERTa, and other embedding model architectures [source]
- /openapi.yaml post /api/embed Creates vector embeddings representing the input text [source]
- <Note> The `/api/embed` endpoint returns L2‑normalized (unit‑length) vectors. </Note> [source]
- queryPrefix: "search_query: " documentPrefix: "search_document: " [source]
- Number of dimensions to generate embeddings for [source]
- outputDimensions must match the dimensions returned by the model. [source]
Related concepts
- ollama — is a related of Ollama embeddings API and local RAG pipelines
- nomic-embed-text — is a instance of Ollama embeddings API and local RAG pipelines
- l2-normalized — is a measure of Ollama embeddings API and local RAG pipelines
- langchain — is a instance of Ollama embeddings API and local RAG pipelines
- 11434 — is a related of Ollama embeddings API and local RAG pipelines
- embeddinggemma — is a instance of Ollama embeddings API and local RAG pipelines
- search_document: — is a part of Ollama embeddings API and local RAG pipelines
Children
- No children recorded.