| 112 | } |
| 113 | |
| 114 | func (r *SQLiteRecorder) RecordPromptUsage(ctx context.Context, req *aibridge.PromptUsageRecord) error { |
| 115 | metadata, _ := json.Marshal(req.Metadata) |
| 116 | _, err := r.stmtInsertPromptUsage.ExecContext(ctx, |
| 117 | uuid.NewString(), req.InterceptionID, req.MsgID, req.Prompt, string(metadata), req.CreatedAt, |
| 118 | ) |
| 119 | if err != nil { |
| 120 | r.logger.Warn(ctx, "failed to record prompt usage", slog.Error(err)) |
| 121 | } |
| 122 | return err |
| 123 | } |
| 124 | |
| 125 | func (r *SQLiteRecorder) RecordModelThought(ctx context.Context, req *aibridge.ModelThoughtRecord) error { |
| 126 | r.logger.Debug(ctx, "model thought recorded (not persisted in SQLite example)") |