From 926e4bb570eebec9af6ef45f47ec01bf08633d64 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 28 Feb 2026 15:51:27 -0500 Subject: [PATCH] Upgrade intent model to qwen2.5:7b, simplify intent prompt rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit config.py: - Default OLLAMA_INTENT_MODEL: qwen2.5:1.5b → qwen2.5:7b - Startup will auto-pull and warm the new model on next container restart intent.py: - Replaced phrase-matching examples in search_web and research_topic rules with semantic descriptions. The 7B model doesn't need example phrases to understand intent — it can reason from the tool's purpose. Removes implied usage patterns that caused misclassifications on conversational phrasing (e.g. "I've been thinking about buying shirts, can you research this?"). - research_topic rule now explicitly covers any subject regardless of phrasing, including shopping decisions, comparisons, how-things-work questions, etc. - search_web rule clarified as "short summary, no note" vs research_topic's "comprehensive written reference" The 1.5B model required prescriptive phrase examples to route correctly; the 7B model has sufficient language understanding to classify from semantic intent. Expected improvement: ~1-2s intent calls (vs 0.4-9s for the 1.5B model which sometimes timed out or misclassified longer/conversational messages). Co-Authored-By: Claude Sonnet 4.6 --- src/fabledassistant/config.py | 4 ++-- src/fabledassistant/services/intent.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fabledassistant/config.py b/src/fabledassistant/config.py index 909be5f..a664464 100644 --- a/src/fabledassistant/config.py +++ b/src/fabledassistant/config.py @@ -24,9 +24,9 @@ class Config: ) OLLAMA_URL: str = os.environ.get("OLLAMA_URL", "http://localhost:11434") OLLAMA_MODEL: str = os.environ.get("OLLAMA_MODEL", "qwen3:latest") - # Optional dedicated model for intent classification (should be small/fast). + # Optional dedicated model for intent classification. # Falls back to OLLAMA_MODEL if not set. Can also be overridden per-user via settings. - OLLAMA_INTENT_MODEL: str = os.environ.get("OLLAMA_INTENT_MODEL", "qwen2.5:1.5b") + OLLAMA_INTENT_MODEL: str = os.environ.get("OLLAMA_INTENT_MODEL", "qwen2.5:7b") # KV cache context window for generation. Lower = less VRAM, less throughput impact. # 8192 is sufficient for most conversations; raise if you paste large documents. OLLAMA_NUM_CTX: int = int(os.environ.get("OLLAMA_NUM_CTX", "8192")) diff --git a/src/fabledassistant/services/intent.py b/src/fabledassistant/services/intent.py index 7d8b1e8..e79b21e 100644 --- a/src/fabledassistant/services/intent.py +++ b/src/fabledassistant/services/intent.py @@ -100,14 +100,16 @@ Rules: - "read", "open", "show me", "what does X say", "display", "pull up" a specific note → use get_note with query=. - "list my notes", "show notes", "recent notes", "browse notes", "notes tagged X" → use list_notes (with optional q or tags). - "tag X with Y", "add tag Y to X", "untag Y from X", "remove tag Y from X" → use update_note with tags=[Y] and tag_mode="add" or "remove". -- search_web: user wants a quick web search to answer a factual question - ("search for X", "look up X", "what is the latest version of X", "find X online", - "google X", "what is X" for quick factual answers — NOT when they want a comprehensive note) -- research_topic: user wants to research a topic and create a comprehensive note from web sources - ("research X", "Research: X", "research X and make a note", "compile notes on X", "write a report on X", - "deep dive into X", "find everything about X", "comprehensive guide to X", - "research where to buy X", "research how to X", "research X and ship to me" — the topic - is everything after "Research:" or "research") +- search_web: user wants a quick factual answer retrieved from the web, without creating a note. + Use for brief lookups where a short summary suffices (current version numbers, quick facts, + "what is X", "look up X"). Do NOT use when the user wants a detailed written reference. +- research_topic: user wants a comprehensive, multi-section research note created from web sources. + Use whenever the user wants to deeply understand, learn about, or get a full written reference + on any subject — regardless of how they phrase it. The topic can be anything: technical subjects, + shopping decisions, comparisons, how things work, historical topics, etc. + The "topic" argument should capture the full subject matter of the request. + Prefer this over search_web when the user's request implies wanting thorough coverage rather than + a quick answer. - "ack": one short, natural sentence confirming the action (tool path only). Vary phrasing — do not always start with "Let me". Omit (null) for chat-only responses. - Do NOT wrap the JSON in markdown code fences."""