Mead.Router.Classifier (mead v0.1.1)

Copy Markdown View Source

Decides whether a turn is routine enough for the local model or needs the cloud.

The decision is a pure function of the input and the history, so it is deterministic and testable without a network. Local is chosen only when the input positively looks routine; any doubt goes to the cloud, where the quality is. The rules are applied in this order:

  1. an input that is not a string, or not valid UTF-8, is :cloud, because it cannot be judged;
  2. an input longer than 280 characters is :cloud;
  3. a history of more than 20 turns is :cloud, because the context is heavy;
  4. an input that asks for reasoning or writing is :cloud;
  5. an input that asks for triage or formatting is :local;
  6. anything else is :cloud.

Summary

Functions

Returns the route the heuristic picks for input given the turns recorded so far.

Functions

classify(history, input)

@spec classify([Mead.Session.Turn.t()], term()) :: :local | :cloud

Returns the route the heuristic picks for input given the turns recorded so far.