Skip to content

feat: Ollama local model support + prompt optimization - #5

Merged
ojfbot merged 3 commits into
mainfrom
feat/ollama-local-models
Mar 27, 2026
Merged

feat: Ollama local model support + prompt optimization#5
ojfbot merged 3 commits into
mainfrom
feat/ollama-local-models

Conversation

@ojfbot

@ojfbot ojfbot commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Ollama provider: Run GroupThink against a locally hosted model (qwen2.5:7b on Apple Silicon) for free — no API key needed
  • Provider abstraction: LLMClient interface with Anthropic and Ollama implementations, factory pattern via createLLMClient(config)
  • Prompt optimization for local models: Few-shot examples, hardened anti-domain rules, dropped tabDescriptions/tabTags, hostname-only URLs — all provider-gated so Anthropic behavior is unchanged
  • Rewritten enforceSubgroups: Title keyword clustering replaces domain clustering for better fallback subgroup quality

Test plan

  • pnpm type-check && pnpm build passes clean
  • Set provider to Ollama in settings, verify "Test Connection" works
  • Hit Refresh — groups should be topic-based (not domain-based)
  • At specificity 6+, groups with 6+ tabs should have subgroups
  • Switch to Anthropic — API key field appears, grouping quality unchanged
  • Existing installs without provider field migrate correctly (infers from API key presence)

🤖 Generated with Claude Code

ojfbot and others added 2 commits March 26, 2026 21:51
Add Ollama as an LLM provider alongside Anthropic, enabling free local
inference on Apple Silicon. Users select provider in settings — Ollama
requires no API key, just a running local server.

- Add LLMProvider type and provider-aware config (types, storage migration)
- Create LLMClient abstraction with Anthropic and Ollama implementations
- Refactor GroupThinkAI to accept config object, use provider-agnostic client
- Update background handlers to pass full config, relax API key guard for Ollama
- Add provider selector, per-provider model lists, and connection test to settings UI
- Gate app init on provider readiness (not just API key presence)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Local 7B models (qwen2.5) default to domain-based grouping and skip
subgroups. Fix with provider-aware prompt engineering and better
client-side fallbacks.

Prompts (src/lib/prompts.ts):
- Add hardened system prompt for local models with explicit anti-domain rules
- Add few-shot good/bad examples showing topic-based grouping
- Add children example for specificity >= 5
- Drop tabDescriptions/tabTags for Ollama (~60% fewer output tokens)
- Strip URL paths for Ollama (hostname only, reduces domain signal)

Pipeline (src/lib/grouping.ts):
- Rewrite enforceSubgroups from domain clustering to title keyword clustering
- Remove "Group A / Group B" alphabetical split fallback
- Leave groups flat when no meaningful keyword clusters found

Client (src/lib/llm-client.ts):
- Set Ollama temperature to 0.15 (avoids deterministic domain-grouping rut)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ojfbot
ojfbot force-pushed the feat/ollama-local-models branch from 8076b3f to 04edd34 Compare March 27, 2026 02:51
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ojfbot
ojfbot merged commit cf8a028 into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant