sessiontitle

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

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

View Source
const MinTurnsForTitle = 2

MinTurnsForTitle is the number of complete user+assistant turns required before a session title is generated.

View Source
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

func BuildPrompt(messages []message.Message) string

BuildPrompt formats the conversation excerpt containing only user and assistant messages from the last maxPromptTurns complete turns.

func CountCompleteTurns

func CountCompleteTurns(msgs []message.Message) int

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

func IsValidSlug(s string) bool

IsValidSlug reports whether s is a valid kebab-case slug: lowercase letters, digits, and single hyphens. Leading, trailing, and consecutive hyphens are rejected.

func ParseTitle

func ParseTitle(raw string) (string, error)

ParseTitle parses the model's JSON response and validates that the title is a valid kebab-case slug.

Types

This section is empty.

Source Files

  • sessiontitle.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL