Skip to content

Local models: keep handovers, search first, clean handoff lines - #547

Merged
chattermate merged 4 commits into
mainfrom
feature/local-model-handover
Dec 1, 2026
Merged

chattermate merged 4 commits into
mainfrom
feature/local-model-handover

Conversation

@chattermate

@chattermate chattermate commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes found running 1.0.34 with Ollama (qwen2.5:7b, JSON_TOOL_OUTPUT_PROVIDERS=OPENAI_COMPATIBLE).

Handover

  • OpenAI-compatible models get the system prompt as system. agno sent it as developer, which Ollama ignores, so the model never saw the agent's instructions.
  • When a json-tool model answers in plain text, the agent asks once more (one short run, one tool) for the transfer / end-chat fields and keeps the reply text. The re-ask uses only what's left of AGENT_RUN_TIMEOUT, is skipped when it has nothing to record, and a transfer_reason with no flag counts as a transfer.
  • A transfer reason outside the enum no longer drops the transfer flag.
  • A reply that is only field names (transfer_to_human:) is never shown to the visitor.

Answers

  • With the instructions now reaching the model, it almost stopped searching (1 of 18 questions) and answered hours and prices from memory. A search-first rule after the json output rule brings it back (12 of 12). json-tool providers only; the Groq golden prompt is updated.

Other

  • Transfer agent: markdown off plus a chat-message rule. Local models wrapped every handoff line in a ```markdown fence and wrote it as a letter.
  • Ticket investigator: a prose reply no longer parses its last character (find("{") == -1).
  • Ticket worker: the startup orphan reap retries while the backend is still migrating, before the run loop starts.
  • AI Configuration subtitle no longer says "already run on ChatterMate AI" on self-hosted installs (was AI Configuration: no ChatterMate AI line on self-hosted installs #548).

Checked on a real install with Ollama: 6 of 6 "let me talk to a person" chats reached the inbox as TRANSFERRED (0 of 3 on 1.0.34); 4 of 6 factual questions answered correctly from the knowledge base (1 of 6 before the search rule). OSS backend suite: 6581 passed.

On an OpenAI-compatible server, agno sent the system prompt with the
"developer" role. Ollama ignores that role, so a local model never saw the
agent's instructions: no json-tool rule, no handover rules, no guardrail.
Send it as "system", which every OpenAI-shaped server accepts.

When a json-tool model still ends its turn in plain text, ask once more,
in a short run with only one tool, for the turn's transfer and end-chat
fields. The reply text stays what the model wrote. The re-ask tool is not
named `json`: Ollama 0.40 drops about half of qwen2.5's calls to a tool of
that name.

A reason outside its enum no longer throws away the transfer flag with it.

Signed-off-by: Runix <admin@chattermate.chat>
The subtitle said agents already run on ChatterMate AI, which only hosted editions have. Self-hosted installs now get a neutral line, and a hosted org on its own model is no longer told it runs on ChatterMate AI.

Signed-off-by: Runix <admin@chattermate.chat>
- json-tool path: a search-first rule after the output rule. With the
  system prompt now reaching Ollama, qwen2.5:7b searched 1 time in 18 and
  answered hours and prices from memory; with the rule, 12 in 12.
- Re-ask: a transfer_reason with no transfer_to_human counts as a
  transfer, a reply that is only field names ("transfer_to_human:") is
  never shown, and the re-ask gets only what's left of AGENT_RUN_TIMEOUT
  and is skipped when it has nothing to record.
- Transfer agent: markdown off and a chat-message style rule. Local
  models wrapped every handoff line in a ```markdown fence and wrote it
  as a letter; a whole-reply prose fence is also stripped.
- Ticket investigator: a prose reply no longer parses its last character
  (find("{") == -1); shares first_json_object with the FAQ generator.
- Ticket worker: the startup orphan reap retries while the schema isn't
  migrated yet, before the run loop starts.

Signed-off-by: Runix <admin@chattermate.chat>
@chattermate chattermate changed the title Keep handovers on local models Local models: keep handovers, search first, clean handoff lines Nov 30, 2026
Signed-off-by: Runix <admin@chattermate.chat>
@chattermate
chattermate merged commit f8f9b66 into main Dec 1, 2026
10 checks passed
@chattermate
chattermate deleted the feature/local-model-handover branch December 1, 2026 08:17
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