refactor: consolidate Ollama model configuration
Build and Push / build (release) Successful in 27s

- Add OLLAMA_EMBEDDING_MODEL for embeddings (nomic-embed-text)
- OLLAMA_MODEL now used for all LLM operations (mistral-nemo-large:latest)
- Remove separate reranker_model setting
- Update WikiPageWriter to use settings instead of hardcoded model
- Improves VRAM efficiency by keeping one model hot

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 11:15:27 +01:00
co-authored by Claude Opus 4.5
parent 5be31a5a00
commit a1832e3245
9 changed files with 27 additions and 14 deletions
+11
View File
@@ -5,6 +5,17 @@ All notable changes to Library Desk will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.3.2] - 2025-12-22
### Changed
- **Consolidated Ollama model configuration** - All LLM operations now use single `OLLAMA_MODEL` environment variable
- Removed separate `reranker_model` setting
- HybridRAG re-ranking, consolidation analysis, and wiki page writing all use the same model
- Improves VRAM efficiency by keeping one model hot
- Added `OLLAMA_EMBEDDING_MODEL` environment variable for embedding model (previously overloaded `OLLAMA_MODEL`)
- Updated WikiPageWriter to accept settings instead of hardcoded model name
## [1.3.1] - 2025-12-16 ## [1.3.1] - 2025-12-16
### Fixed ### Fixed
+2 -1
View File
@@ -49,7 +49,8 @@ QDRANT_PORT=6333
WIKIJS_URL=http://wiki:3000 WIKIJS_URL=http://wiki:3000
SEARXNG_URL=http://searxng:8080 SEARXNG_URL=http://searxng:8080
OLLAMA_URL=http://ollama:11434 OLLAMA_URL=http://ollama:11434
OLLAMA_MODEL=nomic-embed-text OLLAMA_MODEL=mistral-nemo-large:latest
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
REDIS_HOST=redis-shared REDIS_HOST=redis-shared
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_DB=2 REDIS_DB=2
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "library-desk" name = "library-desk"
version = "1.3.1" version = "1.3.2"
description = "Coordination service for The Library system - HybridRAG queries, document ingestion, entity extraction, and knowledge consolidation" description = "Coordination service for The Library system - HybridRAG queries, document ingestion, entity extraction, and knowledge consolidation"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
+3 -3
View File
@@ -62,12 +62,12 @@ class Settings(BaseSettings):
# SearXNG Configuration # SearXNG Configuration
searxng_url: str = Field(default="http://searxng:8080", description="SearXNG URL") searxng_url: str = Field(default="http://searxng:8080", description="SearXNG URL")
# Ollama Configuration (for embeddings) # Ollama Configuration
ollama_url: str = Field(default="http://ollama:11434", description="Ollama URL") ollama_url: str = Field(default="http://ollama:11434", description="Ollama URL")
ollama_model: str = Field(default="nomic-embed-text", description="Ollama embedding model") ollama_model: str = Field(default="mistral-nemo-large:latest", description="Ollama LLM model")
ollama_embedding_model: str = Field(default="nomic-embed-text", description="Ollama embedding model")
# HybridRAG Configuration # HybridRAG Configuration
reranker_model: str = Field(default="mistral-nemo", description="Model for LLM re-ranking")
reranker_enabled: bool = Field(default=True, description="Enable LLM re-ranking") reranker_enabled: bool = Field(default=True, description="Enable LLM re-ranking")
hybrid_rag_vector_limit: int = Field(default=10, ge=1, le=50, description="Vector search limit") hybrid_rag_vector_limit: int = Field(default=10, ge=1, le=50, description="Vector search limit")
hybrid_rag_graph_limit: int = Field(default=10, ge=1, le=50, description="Graph search limit") hybrid_rag_graph_limit: int = Field(default=10, ge=1, le=50, description="Graph search limit")
+1 -1
View File
@@ -113,7 +113,7 @@ def get_ollama_client() -> OllamaClient:
settings = get_settings() settings = get_settings()
client = OllamaClient( client = OllamaClient(
base_url=settings.ollama_url, base_url=settings.ollama_url,
model=settings.ollama_model model=settings.ollama_embedding_model
) )
logger.debug("Created Ollama client instance") logger.debug("Created Ollama client instance")
return client return client
+1 -1
View File
@@ -229,7 +229,7 @@ async def smart_create_page(
content_extractor=content_extractor, content_extractor=content_extractor,
settings=settings settings=settings
) )
wiki_page_writer = WikiPageWriter(ollama_client=ollama_client) wiki_page_writer = WikiPageWriter(ollama_client=ollama_client, settings=settings)
# Step 1-5: Research + Generate + Create page # Step 1-5: Research + Generate + Create page
page, research_data = await wiki_service.smart_create_page( page, research_data = await wiki_service.smart_create_page(
+2 -2
View File
@@ -47,7 +47,7 @@ class ConsolidationService:
self.ollama = ollama self.ollama = ollama
self.wiki = wiki self.wiki = wiki
self.settings = settings self.settings = settings
self.wiki_page_writer = WikiPageWriter(ollama_client=ollama) self.wiki_page_writer = WikiPageWriter(ollama_client=ollama, settings=settings)
self.ingestion_service = ingestion_service # Optional to avoid circular dependency self.ingestion_service = ingestion_service # Optional to avoid circular dependency
async def consolidate_knowledge( async def consolidate_knowledge(
@@ -465,7 +465,7 @@ JSON:"""
# Call Ollama for analysis # Call Ollama for analysis
response = await self.ollama.generate_text( response = await self.ollama.generate_text(
prompt=prompt, prompt=prompt,
model=self.settings.reranker_model, # Use mistral-nemo model=self.settings.ollama_model,
stream=False stream=False
) )
+2 -2
View File
@@ -6,7 +6,7 @@ HybridRAG service combining vector, graph, and web search.
1. Parallel Retrieval - Vector + Graph + Web search 1. Parallel Retrieval - Vector + Graph + Web search
2. RRF Fusion - Merge results with Reciprocal Rank Fusion 2. RRF Fusion - Merge results with Reciprocal Rank Fusion
3. Enrichment - Add related dossiers via graph 3. Enrichment - Add related dossiers via graph
4. LLM Re-ranking - Re-rank with mistral-nemo 4. LLM Re-ranking - Re-rank with configured Ollama model
5. Context Formatting - Format for LLM consumption 5. Context Formatting - Format for LLM consumption
6. Persistence - Store for Librarian processing 6. Persistence - Store for Librarian processing
""" """
@@ -65,7 +65,7 @@ class HybridRAGService:
self.ollama = ollama_client self.ollama = ollama_client
self.content_extractor = content_extractor self.content_extractor = content_extractor
self.settings = settings self.settings = settings
self.reranker_model = settings.reranker_model self.reranker_model = settings.ollama_model
async def search( async def search(
self, self,
+4 -3
View File
@@ -1,7 +1,7 @@
""" """
Intelligent Wiki Page Writer Service Intelligent Wiki Page Writer Service
Uses LLM (mistral-nemo) to create and reconstruct wiki pages with: Uses LLM to create and reconstruct wiki pages with:
- Holistic content restructuring - Holistic content restructuring
- Zero fact loss (unless superseded) - Zero fact loss (unless superseded)
- Conflict detection and flagging - Conflict detection and flagging
@@ -25,15 +25,16 @@ class WikiPageWriter:
Intelligent wiki page writer using LLM for content generation and restructuring. Intelligent wiki page writer using LLM for content generation and restructuring.
""" """
def __init__(self, ollama_client): def __init__(self, ollama_client, settings):
""" """
Initialize wiki page writer. Initialize wiki page writer.
Args: Args:
ollama_client: OllamaClient for LLM operations ollama_client: OllamaClient for LLM operations
settings: Application settings
""" """
self.ollama = ollama_client self.ollama = ollama_client
self.model = "mistral-nemo" # Default model for writing self.model = settings.ollama_model
async def create_page( async def create_page(
self, self,