CompressionRule

org.llm4s.context.CompressionRule
See theCompressionRule companion object
@Stable
final case class CompressionRule

Represents a named compression rule that transforms a sequence of messages.

Rules are applied sequentially by DeterministicCompressor until the token budget is met. Each rule is designed to be:

  • '''Idempotent''': Applying twice produces the same result
  • '''Safe''': Never removes critical semantic information
  • '''Measurable''': Token reduction can be calculated

Value parameters

apply

The transformation function

name

Identifier for logging and debugging

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def withApply(apply: Seq[Message] => Seq[Message]): CompressionRule

Sets the transformation function.

Sets the transformation function.

Attributes

def withName(name: String): CompressionRule

Sets the rule's identifier.

Sets the rule's identifier.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product