LemonChannels.Adapters.WhatsApp.ModelPolicyAdapter (lemon_channels v0.1.0)

View Source

Adapter that integrates WhatsApp with the unified ModelPolicy system.

Provides model and thinking-level resolution for the WhatsApp transport. Uses session overrides (ephemeral, stored in ETS) and persistent policy storage via LemonChannels.ModelPolicy. No legacy fallback needed — WhatsApp is a new channel with no pre-ModelPolicy data to migrate.

Summary

Functions

clear_default_thinking_preference(account_id, chat_id, thread_id)

@spec clear_default_thinking_preference(binary() | nil, term(), term()) :: boolean()

clear_default_thinking_preference(account_id, chat_id, thread_id, levels)

default_model_preference(account_id, chat_id, thread_id)

@spec default_model_preference(binary() | nil, term(), term()) :: binary() | nil

default_thinking_preference(account_id, chat_id, thread_id)

@spec default_thinking_preference(binary() | nil, term(), term()) :: binary() | nil

default_thinking_preference(account_id, chat_id, thread_id, levels)

ensure_session_table()

format_thinking_line(level, source)

@spec format_thinking_line(term(), term()) :: binary()

put_default_model_preference(account_id, chat_id, thread_id, model)

@spec put_default_model_preference(binary() | nil, term(), term(), term()) :: :ok

put_default_thinking_preference(account_id, chat_id, thread_id, level)

@spec put_default_thinking_preference(binary() | nil, term(), term(), term()) :: :ok

put_default_thinking_preference(account_id, chat_id, thread_id, level, levels)

put_session_model_override(session_key, model)

@spec put_session_model_override(term(), term()) :: :ok

resolve_model_hint(account_id, session_key, chat_id, thread_id)

@spec resolve_model_hint(binary() | nil, term(), term(), term()) ::
  {binary() | nil, :session | :future | nil}

resolve_thinking_hint(account_id, chat_id, thread_id)

@spec resolve_thinking_hint(binary() | nil, term(), term()) ::
  {binary() | nil, :topic | :chat | nil}

route_for(account_id, chat_id, thread_id)

@spec route_for(map() | String.t(), term(), term()) ::
  LemonChannels.ModelPolicy.Route.t()

session_model_override(session_key)

@spec session_model_override(term()) :: binary() | nil