truncate

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayInfo

type ArrayInfo struct {
	Path  string
	Count int
	Size  int // Character size of the array in JSON
}

ArrayInfo holds information about found arrays

type TruncationResult

type TruncationResult struct {
	TruncatedContent string `json:"truncated_content"`
	CacheKey         string `json:"cache_key,omitempty"`
	RecordPath       string `json:"record_path,omitempty"`
	TotalRecords     int    `json:"total_records,omitempty"`
	TotalSize        int    `json:"total_size"`
	CacheAvailable   bool   `json:"cache_available"`
}

TruncationResult represents the result of truncating a tool response

type Truncator

type Truncator struct {
	// contains filtered or unexported fields
}

Truncator handles truncating large tool responses

func NewTruncator

func NewTruncator(limit int) *Truncator

NewTruncator creates a new truncator with the specified character limit

func (*Truncator) ShouldTruncate

func (t *Truncator) ShouldTruncate(content string) bool

ShouldTruncate returns true if content should be truncated

func (*Truncator) Truncate

func (t *Truncator) Truncate(content, toolName string, args map[string]interface{}) *TruncationResult

Truncate analyzes and truncates a tool response if it exceeds the limit

Jump to

Keyboard shortcuts

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