turn

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package turn extracts and merges conversation turn bodies from journal entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTurnBody

func ExtractTurnBody(lines []string, start int) (string, int)

ExtractTurnBody extracts the body text from lines[start:] until the next turn header. Skips a leading blank line.

Parameters:

  • lines: All lines of the journal entry
  • start: Index of the first line after the turn header

Returns:

  • string: Trimmed body content
  • int: Index one past the last body line

func MergeConsecutiveTurns

func MergeConsecutiveTurns(content string) string

MergeConsecutiveTurns merges back-to-back turns from the same role into a single turn. Keeps the first header and concatenates all bodies. This reduces noise from sequences like 4 consecutive Assistant turns each with a single tool call.

Parameters:

  • content: Journal entry content with potential consecutive same-role turns

Returns:

  • string: Content with consecutive same-role turns merged

Types

This section is empty.

Jump to

Keyboard shortcuts

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