Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,15 @@ jobs:
run: go install github.com/securego/gosec/v2/cmd/gosec@v2.22.2 && gosec -no-fail ./...
- name: Secret scan
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq ripgrep
! rg -n "(sk_live_|sk_test_|ghp_|gho_|AKIA|BEGIN (RSA |OPENSSH )?PRIVATE KEY)" \
--glob '!*.md' --glob '!.github/**' . || \
--glob '!*.md' \
--glob '!*.mdx' \
--glob '!.github/**' \
--glob '!docs/**' \
--glob '!internal/memory/privacy/**' \
--glob '!dashboard/tests/**' \
. || \
(echo "Possible secret detected" && exit 1)

ci-success:
Expand Down
16 changes: 11 additions & 5 deletions internal/evaluation/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import (
"agent-memory/internal/llm"
)

func benchmarkDebug(format string, args ...any) {
if os.Getenv("BENCHMARK_DEBUG") == "1" {
fmt.Printf("DEBUG: "+format+"\n", args...)
}
}

type BenchmarkConfig struct {
Model string
MaxTokens int
Expand Down Expand Up @@ -200,7 +206,7 @@ Example: {"correctness": 85, "completeness": 90, "relevance": 95, "overall": 90}
// Filter out <think>...</think> tags if they exist
cleanContent := regexp.MustCompile(`(?s)<think>.*?</think>`).ReplaceAllString(resp.Content, "")

fmt.Printf("DEBUG: Retrieved Context for %q:\n%s\n", question, answer)
benchmarkDebug("Retrieved Context for %q:\n%s", question, answer)

var rubric QARubricResult
content := strings.ToLower(cleanContent)
Expand Down Expand Up @@ -521,7 +527,7 @@ func (r *BenchmarkRunner) runBenchmark(ctx context.Context, dataset *BenchmarkDa
}
if err != nil {
ingestErr = err
fmt.Printf("DEBUG: Ingest Error for memory %s chunk %d: %v\n", mem.ID, i, err)
benchmarkDebug("Ingest Error for memory %s chunk %d: %v", mem.ID, i, err)
break
}
}
Expand Down Expand Up @@ -593,7 +599,7 @@ func (r *BenchmarkRunner) runBenchmark(ctx context.Context, dataset *BenchmarkDa
scored = true
} else {
if rubricErr != nil {
fmt.Printf("DEBUG: ScoreAnswerRubric failed: %v\n", rubricErr)
benchmarkDebug("ScoreAnswerRubric failed: %v", rubricErr)
}
// Fallback to simple scoring
score, scoreErr = r.scorer.ScoreAnswer(ctx, question.Question, answer, question.GroundTruth)
Expand All @@ -611,9 +617,9 @@ func (r *BenchmarkRunner) runBenchmark(ctx context.Context, dataset *BenchmarkDa
scored = true
}
if scored {
fmt.Printf("DEBUG: Question %s\n - Query: %q\n - Retrieved: %q\n - Expected: %q\n - Score: %.2f\n", question.ID, question.Question, answer, question.GroundTruth, score)
benchmarkDebug("Question %s\n - Query: %q\n - Retrieved: %q\n - Expected: %q\n - Score: %.2f", question.ID, question.Question, answer, question.GroundTruth, score)
} else if scoreErr != nil {
fmt.Printf("DEBUG: Question %s - Scoring Error: %v\n", question.ID, scoreErr)
benchmarkDebug("Question %s - Scoring Error: %v", question.ID, scoreErr)
}
hitRank := hitRank(memoryResults, question.MemoryID)

Expand Down
Loading