Switch from embeddinggemma:300m to qwen3-embedding:0.6b

This commit is contained in:
Renn F
2026-01-08 18:08:29 +01:00
parent 955455d704
commit 6ea4ba2bbe
10 changed files with 24 additions and 23 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ pnpm test
| Container Runtime | Docker + Docker Compose | | Container Runtime | Docker + Docker Compose |
| Cloud LLM | Claude API (claude-opus-4-5-20251101) | | Cloud LLM | Claude API (claude-opus-4-5-20251101) |
| Local LLM | Ollama (glm-4.7:cloud for HyDE/RAG) | | Local LLM | Ollama (glm-4.7:cloud for HyDE/RAG) |
| Embeddings | embeddinggemma:300m (768 dim) | | Embeddings | qwen3-embedding:0.6b (1024 dim) |
| Frontend | React / Next.js (future) | | Frontend | React / Next.js (future) |
## Multi-Agent Workspace Structure ## Multi-Agent Workspace Structure
@@ -359,7 +359,7 @@ ROBOCO_RAG_USE_HYDE=true
ROBOCO_RAG_USE_HYBRID_SEARCH=true ROBOCO_RAG_USE_HYBRID_SEARCH=true
# AI/LLM # AI/LLM
ROBOCO_DEFAULT_EMBEDDING_MODEL=embeddinggemma:300m ROBOCO_DEFAULT_EMBEDDING_MODEL=qwen3-embedding:0.6b
ROBOCO_LOCAL_LLM_MODEL=glm-4.7:cloud ROBOCO_LOCAL_LLM_MODEL=glm-4.7:cloud
ROBOCO_LOCAL_LLM_BASE_URL=http://roboco-ollama:11434/v1 ROBOCO_LOCAL_LLM_BASE_URL=http://roboco-ollama:11434/v1
ROBOCO_OLLAMA_BASE_URL=http://roboco-ollama:11434 ROBOCO_OLLAMA_BASE_URL=http://roboco-ollama:11434
@@ -387,7 +387,7 @@ The startup order is critical due to dependencies:
postgres ──┐ postgres ──┐
redis ─────┼──> ollama ──> ollama-init ──> orchestrator redis ─────┼──> ollama ──> ollama-init ──> orchestrator
│ │ │ │ │ │
│ │ └── Pulls embeddinggemma:300m, glm-4.7:cloud │ │ └── Pulls qwen3-embedding:0.6b, glm-4.7:cloud
│ └── Healthcheck: ollama list │ └── Healthcheck: ollama list
└── Healthcheck: pg_isready, redis-cli ping └── Healthcheck: pg_isready, redis-cli ping
``` ```
@@ -404,7 +404,7 @@ Ollama provides two APIs:
- `/v1/*` - OpenAI-compatible API (for LLM chat/completion) - `/v1/*` - OpenAI-compatible API (for LLM chat/completion)
- `/api/*` - Native Ollama API (for embeddings, model management) - `/api/*` - Native Ollama API (for embeddings, model management)
The embedder uses `/api/embed` endpoint with the `embeddinggemma:300m` model. The embedder uses `/api/embed` endpoint with the `qwen3-embedding:0.6b` model.
**Environment variables for Docker:** **Environment variables for Docker:**
```bash ```bash
+1 -1
View File
@@ -176,7 +176,7 @@ uv run mypy roboco/
| Vector Store | pgvector (via piragi) | | Vector Store | pgvector (via piragi) |
| Cache/Queue | Redis | | Cache/Queue | Redis |
| RAG Library | piragi | | RAG Library | piragi |
| Embeddings | embeddinggemma:300m (sentence-transformers) | | Embeddings | qwen3-embedding:0.6b (sentence-transformers) |
| Local LLM | Ollama (glm-4.7:cloud) | | Local LLM | Ollama (glm-4.7:cloud) |
| Cloud LLM | Claude API (Anthropic) | | Cloud LLM | Claude API (Anthropic) |
| Package Manager | uv | | Package Manager | uv |
+4 -4
View File
@@ -72,10 +72,10 @@ services:
command: command:
- | - |
set -e set -e
echo "=== Pulling embedding model (embeddinggemma:300m) ===" echo "=== Pulling embedding model (qwen3-embedding:0.6b) ==="
# Ollama /api/pull streams JSON lines until complete - consume full stream # Ollama /api/pull streams JSON lines until complete - consume full stream
# Note: $$ escapes $ for docker-compose variable substitution # Note: $$ escapes $ for docker-compose variable substitution
curl -sN http://ollama:11434/api/pull -d '{"name":"embeddinggemma:300m"}' | while read -r line; do curl -sN http://ollama:11434/api/pull -d '{"name":"qwen3-embedding:0.6b"}' | while read -r line; do
status=$$(echo "$$line" | grep -o '"status":"[^"]*"' | cut -d'"' -f4) status=$$(echo "$$line" | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
[ -n "$$status" ] && echo " $$status" [ -n "$$status" ] && echo " $$status"
done done
@@ -85,7 +85,7 @@ services:
[ -n "$$status" ] && echo " $$status" [ -n "$$status" ] && echo " $$status"
done done
echo "=== Verifying models are available ===" echo "=== Verifying models are available ==="
curl -sf http://ollama:11434/api/tags | grep -q "embeddinggemma" && echo " embeddinggemma: OK" curl -sf http://ollama:11434/api/tags | grep -q "qwen3-embedding" && echo " qwen3-embedding: OK"
curl -sf http://ollama:11434/api/tags | grep -q "glm-4.7" && echo " glm-4.7: OK" curl -sf http://ollama:11434/api/tags | grep -q "glm-4.7" && echo " glm-4.7: OK"
echo "=== All models ready! ===" echo "=== All models ready! ==="
@@ -221,7 +221,7 @@ services:
# Ollama (use container name) # Ollama (use container name)
ROBOCO_LOCAL_LLM_BASE_URL: http://roboco-ollama:11434/v1 ROBOCO_LOCAL_LLM_BASE_URL: http://roboco-ollama:11434/v1
ROBOCO_LOCAL_LLM_MODEL: glm-4.7:cloud ROBOCO_LOCAL_LLM_MODEL: glm-4.7:cloud
ROBOCO_DEFAULT_EMBEDDING_MODEL: embeddinggemma:300m ROBOCO_DEFAULT_EMBEDDING_MODEL: qwen3-embedding:0.6b
ROBOCO_OLLAMA_BASE_URL: http://roboco-ollama:11434 ROBOCO_OLLAMA_BASE_URL: http://roboco-ollama:11434
# Host paths for spawning agent containers (required for Docker-in-Docker) # Host paths for spawning agent containers (required for Docker-in-Docker)
# IMPORTANT: These must be ABSOLUTE paths on the host filesystem # IMPORTANT: These must be ABSOLUTE paths on the host filesystem
+4 -4
View File
@@ -72,10 +72,10 @@ services:
command: command:
- | - |
set -e set -e
echo "=== Pulling embedding model (embeddinggemma:300m) ===" echo "=== Pulling embedding model (qwen3-embedding:0.6b) ==="
# Ollama /api/pull streams JSON lines until complete - consume full stream # Ollama /api/pull streams JSON lines until complete - consume full stream
# Note: $$ escapes $ for docker-compose variable substitution # Note: $$ escapes $ for docker-compose variable substitution
curl -sN http://ollama:11434/api/pull -d '{"name":"embeddinggemma:300m"}' | while read -r line; do curl -sN http://ollama:11434/api/pull -d '{"name":"qwen3-embedding:0.6b"}' | while read -r line; do
status=$$(echo "$$line" | grep -o '"status":"[^"]*"' | cut -d'"' -f4) status=$$(echo "$$line" | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
[ -n "$$status" ] && echo " $$status" [ -n "$$status" ] && echo " $$status"
done done
@@ -85,7 +85,7 @@ services:
[ -n "$$status" ] && echo " $$status" [ -n "$$status" ] && echo " $$status"
done done
echo "=== Verifying models are available ===" echo "=== Verifying models are available ==="
curl -sf http://ollama:11434/api/tags | grep -q "embeddinggemma" && echo " embeddinggemma: OK" curl -sf http://ollama:11434/api/tags | grep -q "qwen3-embedding" && echo " qwen3-embedding: OK"
curl -sf http://ollama:11434/api/tags | grep -q "glm-4.7" && echo " glm-4.7: OK" curl -sf http://ollama:11434/api/tags | grep -q "glm-4.7" && echo " glm-4.7: OK"
echo "=== All models ready! ===" echo "=== All models ready! ==="
@@ -221,7 +221,7 @@ services:
# Ollama (use container name) # Ollama (use container name)
ROBOCO_LOCAL_LLM_BASE_URL: http://roboco-ollama:11434/v1 ROBOCO_LOCAL_LLM_BASE_URL: http://roboco-ollama:11434/v1
ROBOCO_LOCAL_LLM_MODEL: glm-4.7:cloud ROBOCO_LOCAL_LLM_MODEL: glm-4.7:cloud
ROBOCO_DEFAULT_EMBEDDING_MODEL: embeddinggemma:300m ROBOCO_DEFAULT_EMBEDDING_MODEL: qwen3-embedding:0.6b
ROBOCO_OLLAMA_BASE_URL: http://roboco-ollama:11434 ROBOCO_OLLAMA_BASE_URL: http://roboco-ollama:11434
# Host paths for spawning agent containers (required for Docker-in-Docker) # Host paths for spawning agent containers (required for Docker-in-Docker)
# IMPORTANT: These must be ABSOLUTE paths on the host filesystem # IMPORTANT: These must be ABSOLUTE paths on the host filesystem
+2 -2
View File
@@ -41,8 +41,8 @@ Environment variables for RoboCo (prefix: `ROBOCO_`).
| Variable | Default | Description | | Variable | Default | Description |
|----------|---------|-------------| |----------|---------|-------------|
| `ROBOCO_DEFAULT_EMBEDDING_MODEL` | `embeddinggemma:300m` | Embedding model | | `ROBOCO_DEFAULT_EMBEDDING_MODEL` | `qwen3-embedding:0.6b` | Embedding model |
| `ROBOCO_EMBEDDING_DIMENSIONS` | `768` | Embedding dimensions | | `ROBOCO_EMBEDDING_DIMENSIONS` | `1024` | Embedding dimensions |
| `ROBOCO_RAG_CHUNK_STRATEGY` | `fixed` | fixed/semantic/hierarchical/contextual | | `ROBOCO_RAG_CHUNK_STRATEGY` | `fixed` | fixed/semantic/hierarchical/contextual |
| `ROBOCO_RAG_CHUNK_SIZE` | `512` | Base chunk size | | `ROBOCO_RAG_CHUNK_SIZE` | `512` | Base chunk size |
| `ROBOCO_RAG_CHUNK_SIZE_DOCS` | `1536` | Chunk size for docs | | `ROBOCO_RAG_CHUNK_SIZE_DOCS` | `1536` | Chunk size for docs |
+4 -4
View File
@@ -168,12 +168,12 @@ class Settings(BaseSettings):
# Default models # Default models
default_embedding_model: str = Field( default_embedding_model: str = Field(
default="embeddinggemma:300m", default="qwen3-embedding:0.6b",
description="Embedding model (Ollama). embeddinggemma:300m for quality.", description="Embedding model. Qwen3 Embedding for quality + 32K context.",
) )
embedding_dimensions: int = Field( embedding_dimensions: int = Field(
default=768, default=1024,
description="Embedding dimensions (768 for embeddinggemma/nomic-embed-text)", description="Embedding dimensions (1024 for qwen3-embedding)",
) )
# Local LLM for RAG (HyDE, reranking, etc.) # Local LLM for RAG (HyDE, reranking, etc.)
+1 -1
View File
@@ -51,7 +51,7 @@ from roboco.services.optimal_brain.indexes.reviews import (
logger = structlog.get_logger() logger = structlog.get_logger()
# Max chars per citation content - increased for better synthesis quality # Max chars per citation content - increased for better synthesis quality
# embeddinggemma:300m retrieves higher quality chunks, so more context helps # qwen3-embedding:0.6b retrieves higher quality chunks, so more context helps
MAX_CONTENT_CHARS = 800 MAX_CONTENT_CHARS = 800
@@ -33,7 +33,7 @@ class IndexConfig:
use_hyde: bool = True use_hyde: bool = True
use_hybrid_search: bool = True use_hybrid_search: bool = True
use_cross_encoder: bool = False use_cross_encoder: bool = False
embedding_model: str = "embeddinggemma:300m" embedding_model: str = "qwen3-embedding:0.6b"
llm_model: str = "glm-4.7:cloud" llm_model: str = "glm-4.7:cloud"
llm_base_url: str = "http://roboco-ollama:11434/v1" llm_base_url: str = "http://roboco-ollama:11434/v1"
@@ -145,7 +145,7 @@ class OllamaEmbedder:
def __init__( def __init__(
self, self,
model: str = "embeddinggemma:300m", model: str = "qwen3-embedding:0.6b",
base_url: str | None = None, base_url: str | None = None,
timeout: float = 120.0, timeout: float = 120.0,
max_concurrent: int = MAX_CONCURRENT_BATCHES, max_concurrent: int = MAX_CONCURRENT_BATCHES,
@@ -2,7 +2,7 @@
Shared Embedder Singleton Shared Embedder Singleton
Provides a single embedder instance shared across all index plugins. Provides a single embedder instance shared across all index plugins.
Supports both Ollama models (embeddinggemma, etc.) and SentenceTransformers (BGE, etc.). Supports both Ollama models (qwen3-embedding, ...) and SentenceTransformers (BGE, ...).
""" """
import asyncio import asyncio
@@ -45,6 +45,7 @@ class Embedder(Protocol):
# Known Ollama embedding models # Known Ollama embedding models
OLLAMA_EMBEDDING_MODELS = { OLLAMA_EMBEDDING_MODELS = {
"qwen3-embedding",
"embeddinggemma", "embeddinggemma",
"nomic-embed-text", "nomic-embed-text",
"mxbai-embed-large", "mxbai-embed-large",