Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRecordingLLM ¶
NewRecordingLLM wraps inner so each LLM call is appended to rec. model labels the records (cogito builds requests without a model; the underlying client fills it in), and agentID tags the source ("" for the main session).
Types ¶
type Record ¶
type Record struct {
Timestamp time.Time `json:"timestamp"`
Provider string `json:"provider"` // always "openai"
Model string `json:"model"`
AgentID string `json:"agent_id,omitempty"` // "" = main session
Method string `json:"method"` // chat_completion | ask | stream
Request *openai.ChatCompletionRequest `json:"request"`
Response *openai.ChatCompletionResponse `json:"response,omitempty"` // omitted on error
Error string `json:"error,omitempty"`
}
Record is one captured LLM call, serialized as a single NDJSON line. The first five fields mirror voro/claudemaster's trace.Call so the transcript is directly consumable by its export pipeline; Request/Response are go-openai types and therefore already in the OpenAI-chat shape that pipeline targets.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder appends LLM call records to <dir>/trace.ndjson. It is safe for concurrent use: each Record call is serialized under a mutex so lines never interleave. One unbuffered write syscall per record means a process crash leaves a valid prefix of complete lines.
func NewRecorder ¶
NewRecorder creates dir if needed and opens the transcript for appending.