Skip to main content

Module title_generator

Module title_generator 

Source
Expand description

Auto-generate session titles once a chat has enough context.

Port of hermes-agent’s agent/title_generator.py. The core contract: given the first few turns of a session, ask the LLM to produce a 3-8 word title, and persist it into sessions.label. Runs in the background scheduler — the agent loop itself never blocks on title generation.

Functions§

generate_and_save_title
Produce and persist a short title for chat_id. Returns Ok(None) when the chat doesn’t yet meet the threshold (already labeled, too few messages, or no session row). Returns Ok(Some(title)) on success.