Remove Gemini evaluation budget
build-push / docker (push) Successful in 4m21s

This commit is contained in:
AI Assistant
2026-03-16 13:12:29 +09:00
parent 4b03cc41f7
commit d787f84799
3 changed files with 13 additions and 20 deletions
-13
View File
@@ -18,7 +18,6 @@ type GeminiBatchStats struct {
Failed int `json:"failed"`
SequentialRetried int `json:"sequentialRetried"`
RecommendedCount int `json:"recommendedCount"`
TimedOut bool `json:"timedOut,omitempty"`
Errors []string `json:"errors,omitempty"`
}
@@ -91,10 +90,6 @@ func GeminiCandidateLimit(total int) int {
}
func EvaluateAllCandidatesWithGemini(service *GeminiService, query string, ranked []SearchResult) ([]AIRecommendation, GeminiBatchStats, error) {
return EvaluateAllCandidatesWithGeminiBudget(service, query, ranked, time.Time{})
}
func EvaluateAllCandidatesWithGeminiBudget(service *GeminiService, query string, ranked []SearchResult, deadline time.Time) ([]AIRecommendation, GeminiBatchStats, error) {
if service == nil {
return nil, GeminiBatchStats{}, fmt.Errorf("gemini service is not configured")
}
@@ -112,10 +107,6 @@ func EvaluateAllCandidatesWithGeminiBudget(service *GeminiService, query string,
merged := make([]AIRecommendation, 0, len(ranked))
seen := map[string]bool{}
for idx := 0; idx < limit; idx++ {
if !deadline.IsZero() && time.Now().After(deadline) {
stats.TimedOut = true
break
}
recommendations, err := recoverGeminiCandidateSequentially(service, query, ranked[idx])
if err != nil {
stats.Failed++
@@ -140,10 +131,6 @@ func EvaluateAllCandidatesWithGeminiBudget(service *GeminiService, query string,
stats.RecommendedCount = len(merged)
switch {
case stats.TimedOut && len(merged) > 0:
return merged, stats, fmt.Errorf("gemini vision evaluation stopped early to avoid request timeout")
case stats.TimedOut && len(merged) == 0:
return nil, stats, fmt.Errorf("gemini vision evaluation timed out before any usable results were returned")
case len(merged) > 0 && stats.Failed == 0:
return merged, stats, nil
case len(merged) > 0 && stats.Failed > 0: