Upgrade intent model to qwen2.5:7b, simplify intent prompt rules
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -100,14 +100,16 @@ Rules:
|
||||
- "read", "open", "show me", "what does X say", "display", "pull up" a specific note → use get_note with query=<note name>.
|
||||
- "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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user