Description
n8n-nodes-ollama-embeddings



n8n community nodes for generating text embeddings via Ollama with your n8n workflows. Supports multiple embedding models including Qwen, EmbeddingGemma, Nomic and more for vector stores, similarity search, and AI applications.
🌟 Features
- Two Specialized Nodes:
- Multi-Model Support: Works with Qwen, EmbeddingGemma, Nomic, Snowflake and more
- LangChain Compatible: Seamlessly integrates with n8n’s AI ecosystem
- Flexible Dimensions: Auto-detection and validation based on model capabilities
- Instruction-Aware: Optimized embeddings for queries vs documents
- Batch Processing: Efficient bulk embedding generation
- Ollama Integration: Direct connection to Ollama for embedding generation
- No Middleware Required: Works directly with Ollama’s API endpoints
- Compact Format Option: Single-line embeddings for easy copy/paste
– Ollama Embeddings: For vector store integration (Supabase, Qdrant, PGVector, etc.)
– Ollama Embeddings Tool: For direct embedding generation in workflows
📦 Installation
In n8n
1. Go to Settings > Community Nodes
2. Search for n8n-nodes-qwen-embedding
3. Click Install
Manual Installation
npm install n8n-nodes-qwen-embedding
🚀 Prerequisites
You need to have Ollama installed and running with a Qwen model:
1. Install Ollama: Visit https://ollama.com for installation instructions
2. Pull an embedding model:
Qwen3-Embedding models (specialized for embeddings):
ollama pull qwen3-embedding:0.6b # 1024 dimensions, 32K contextEmbeddingGemma models (Google's lightweight embeddings):
ollama pull embeddinggemma:300m # 768 dimensions, 2K context
ollama pull embeddinggemma:300m-bf16 # Higher precision variantNomic Embed models (performant embeddings):
ollama pull nomic-embed-text # 768 dimensions, 8K contextSnowflake Arctic Embed:
ollama pull snowflake-arctic-embed:110m # 1024 dimensions
3. Verify Ollama is running:
ollama list # Should show your pulled models
Ollama will be available at http://localhost:11434 by default
📊 Supported Models Comparison
| Model | Dimensions | Context | Size | Best For |
|——-|————|———|——|———-|
| qwen3-embedding:0.6b | 32-1024 (flexible) | 32K tokens | ~639MB | General purpose, multilingual |
| embeddinggemma:300m | 128-768 (MRL) | 2K tokens | ~338MB | Lightweight, fast inference |
| nomic-embed-text | 768 (fixed) | 8K tokens | ~274MB | Balanced performance |
| snowflake-arctic-embed | 1024 (fixed) | 512 tokens | ~332MB | Short text, high precision |
Choosing a Model:
🔧 Setup
⚠️ CRITICAL: Ollama URL Configuration
ALWAYS remove trailing slashes from your Ollama URL!
✅ CORRECT: http://localhost:11434
❌ WRONG: http://localhost:11434/
Why this matters: A trailing slash creates a double-slash in the API path (http://host:11434//api/embed), which causes HTTP parsers to silently transform POST requests to GET requests, resulting in HTTP 405 “Method Not Allowed” errors.
This is the #1 cause of 405 errors with this node. Always verify your Ollama URL format first.
1. Configure Credentials (Optional)
For self-hosted Ollama without authentication: You can skip credential configuration. The node will connect directly to your Ollama instance.
For authenticated Ollama instances:
1. In n8n, go to Credentials > New
2. Select Qwen Embedding API (Ollama)
3. Enter:
– Ollama URL: http://localhost:11434 (NO trailing slash!)
– Model Name: qwen3-embedding:0.6b (or your chosen model)
– API Key: Your authentication token (if required)
4. IMPORTANT: Verify your URL has NO trailing slash before saving
5. Click Test Connection to verify
2. Using the Nodes
#### Qwen Embedding (Vector Store Integration)
Connect to any vector store node:
[Vector Store] ← [Qwen Embedding]
(Stores) (Provides embeddings)
Use Cases:
#### Qwen Embedding Tool (Direct Usage)
Use in any workflow for direct embedding generation:
[Trigger] → [Qwen Embedding Tool] → [Process/Store]
Use Cases:
⚙️ Configuration Options
Performance Mode
Controls timeout and retry behavior based on your hardware:
– GPU detected (<1s response): 10s timeout, 2 retries
- CPU detected (>5s response): 60s timeout, 3 retries
– Works great for dynamic environments
– 10 second timeout
– 2 retry attempts
– Best for NVIDIA GPU setups
– 60 second timeout
– 3 retry attempts
– Prevents timeout errors on CPU-only systems
– Set your own timeout (in milliseconds)
– Configure max retry attempts (0-5)
How Auto-Detection Works:
First request measures actual response time:
Response < 1s → GPU detected → timeout = 10s
Response > 5s → CPU detected → timeout = 60s
1s ≤ response ≤ 5s → keep default 30s
Dimensions
Adjust embedding vector size based on model capabilities:
– Qwen: 32-1024 (flexible via MRL)
– EmbeddingGemma: 128-768 (flexible via MRL)
– Nomic: 768 (fixed)
– Snowflake: 1024 (fixed)
Implementation: Models with MRL support (Qwen, EmbeddingGemma) can adjust dimensions without retraining. Fixed-dimension models will show a warning if you try to adjust.
Instruction Type
Optimize embeddings for specific use cases:
– Prefix: "Instruct: Retrieve semantically similar text.nQuery: "
– Use for: User questions, search inputs
– Prefix: "Instruct: Represent this document for retrieval.nDocument: "
– Use for: Indexing documents, knowledge base entries
Performance Impact: 1-5% better semantic matching when query/document types match their use case.
Context Prefix
Add custom context to all texts before embedding:
Example:
Context Prefix: "Medical context:"
Input text: "patient symptoms include fever"
Embedded as: "Medical context: patient symptoms include fever"
Use Cases:
Return Format (Tool Only)
Controls output structure:
{
"embedding": [0.123, 0.456, ...],
"dimensions": 1024,
"text": "original text",
"model": "qwen3-embedding:0.6b",
"metadata": { ... } // if includeMetadata enabled
}
{
"text": "original text",
"vector": [0.123, 0.456, ...],
"dimensions": 1024
}
{
"embedding": [0.123, 0.456, ...]
}
Include Metadata (Tool Only)
When enabled, adds processing metadata to output:
{
"metadata": {
"prefix": "Medical context:", // Context prefix used
"instruction": "query", // Instruction type applied
"timestamp": "2025-10-07T19:44:23Z", // Processing time
"batchSize": 5 // Number of texts (batch mode only)
}
}
Use Cases:
Custom Timeout & Max Retries (Custom Mode Only)
Fine-tune request behavior:
Retry Logic:
Operation (Tool Only)
📝 Examples
Example 1: Vector Store with RAG
1. Add "Supabase Vector Store" node
2. Add "Qwen Embedding" node
3. Connect Qwen to Vector Store's embedding input
4. Configure your collection and start indexing
Example 2: Semantic Search
1. Add "Manual Trigger" node
2. Add "Qwen Embedding Tool" node (set to "Generate Embedding")
3. Add another "Qwen Embedding Tool" for documents
4. Add "Code" node to calculate similarities
Example 3: Batch Processing
// Input: Array of texts
{
"texts": [
"First document",
"Second document",
"Third document"
]
}// Qwen Embedding Tool (Batch mode) output:
{
"embeddings": [[...], [...], [...]],
"count": 3,
"dimensions": 1024
}
🔬 Technical Details
Model Information
Qwen Models:
qwen3-embedding:0.6b – 1024d, 32K context, multilingual (100+ languages)EmbeddingGemma Models:
embeddinggemma:300m – 768d, 2K context, lightweightNomic Models:
nomic-embed-text – 768d, 8K context, balanced performanceSnowflake Models:
snowflake-arctic-embed – 1024d, 512 context, high precisionPerformance Characteristics
API Compatibility
/api/embed endpoint (POST method){model: string, input: string}{embeddings: number[][]}🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (git checkout -b feature/AmazingFeature)
3. Commit your changes (git commit -m 'Add some AmazingFeature')
4. Push to the branch (git push origin feature/AmazingFeature)
5. Open a Pull Request
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
🙏 Acknowledgments
🐛 Troubleshooting
HTTP 405 “Method Not Allowed” Errors
Most Common Cause (90% of cases): Trailing slash in Ollama URL configuration.
Check your credential configuration:
✅ Correct: http://localhost:11434
❌ Wrong: http://localhost:11434/
Quick Fix:
1. Go to N8N Credentials
2. Edit your Ollama credential
3. Remove the trailing slash from the URL
4. Save and test again
For other 405 error causes, see the comprehensive NPM Package
📮 Support
For issues and questions:
—
Made with ❤️ for the n8n community