llmstats

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package llmstats provides a durable sink for per-call LLM metrics. It implements llm.StatsSink by appending one JSON record per call to a local JSONL file (.sdd/stats/llm.jsonl), so prompt-cache effectiveness and token usage become measurable over time without an external service (d-tac-zis).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSink

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

FileSink appends one JSON record per LLM call to a JSONL file. Safe for concurrent use — batch operations record from multiple goroutines.

func NewFileSink

func NewFileSink(dir string) (*FileSink, error)

NewFileSink returns a sink that appends to <dir>/llm.jsonl, creating dir if it does not exist.

func (*FileSink) RecordCall

func (s *FileSink) RecordCall(stat llm.CallStat)

RecordCall appends one JSON line for the call. Errors are swallowed: stats collection is best-effort and must never break a capture or summarize.

Jump to

Keyboard shortcuts

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