Documentation
¶
Overview ¶
Package sessiontitle generates short, descriptive kebab-case title slugs for chat sessions using a single-turn structured JSON LLM call over conversation history.
Index ¶
Constants ¶
const MinTurnsForTitle = 2
MinTurnsForTitle is the number of complete user+assistant turns required before a session title is generated.
const SystemPrompt = `` /* 588-byte string literal not displayed */
SystemPrompt is the instructions sent to the title generation model.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
BuildPrompt formats the conversation excerpt containing only user and assistant messages from the last maxPromptTurns complete turns.
func CountCompleteTurns ¶
CountCompleteTurns counts how many completed user+assistant turn pairs exist in the message history. A complete turn is a User message followed by one or more Model (assistant) messages; consecutive Model messages after the same User do not increment the count again.
func Generate ¶
func Generate(ctx context.Context, apiKey string, messages []message.Message, titleModel model.ID, effort string, opts ...client.Option) (string, error)
Generate sends the conversation excerpt to the configured title model and returns the parsed kebab-case title slug. opts configures additional transport options (e.g. client.WithProviderPreferences).
func IsValidSlug ¶
IsValidSlug reports whether s is a valid kebab-case slug: lowercase letters, digits, and single hyphens. Leading, trailing, and consecutive hyphens are rejected.
Types ¶
This section is empty.
Source Files
¶
- sessiontitle.go