feat(generation): select articles in three passes
This commit is contained in:
@ -45,7 +45,7 @@ func TestTicket28GenerationAggregatesAllAssetsBeforeSelectionAndFailsClosed(t *t
|
||||
}
|
||||
results := []any{}
|
||||
for i := range body.States {
|
||||
score := []float64{0.2, 0.9}[i]
|
||||
score := []float64{0.9, 0.9}[i]
|
||||
if calls == 2 {
|
||||
score = []float64{0.8, 0.05}[i]
|
||||
}
|
||||
@ -53,9 +53,9 @@ func TestTicket28GenerationAggregatesAllAssetsBeforeSelectionAndFailsClosed(t *t
|
||||
if calls == 2 && failure == "truncated_long_article" {
|
||||
usage["truncated"] = true
|
||||
usage["state_tokens_dropped"] = 800
|
||||
usage["truncated_questions"] = []string{"relevance"}
|
||||
usage["truncated_questions"] = []string{"direct_mention"}
|
||||
}
|
||||
results = append(results, map[string]any{"answers": map[string]any{"relevance": map[string]any{"type": "score", "score": score, "answer_confidence": 0.99}}, "usage": usage})
|
||||
results = append(results, map[string]any{"answers": map[string]any{"direct_mention": map[string]any{"type": "noul", "noul": 1 - score, "answer_confidence": 0.99}}, "usage": usage})
|
||||
}
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{"results": results})
|
||||
}))
|
||||
@ -64,7 +64,7 @@ func TestTicket28GenerationAggregatesAllAssetsBeforeSelectionAndFailsClosed(t *t
|
||||
model, key := "model", models.SourceYahooFinance
|
||||
feed := &ticket17HTTPScraper{articles: []scraper.Article{{Title: "first", URL: "https://fixture.invalid/first", Content: content}, {Title: "second", URL: "https://fixture.invalid/second", Content: content}}}
|
||||
summary := &ticket17HTTPSummary{}
|
||||
repo := &ticket17HTTPRepo{input: generation.UserInput{SummaryModelID: &model, Language: "fr", RankingMode: "title_content", GlobalLimit: 1, Assets: []models.UserAsset{{Name: "A", Symbol: "A"}, {Name: "B", Symbol: "B"}}, Sources: []models.Source{{ID: "source", SourceKey: &key, Enabled: true, ArticleLimit: 1}}}}
|
||||
repo := &ticket17HTTPRepo{input: generation.UserInput{SummaryModelID: &model, Language: "fr", RankingMode: "title_content", GlobalLimit: 1, Assets: []models.UserAsset{{Name: "A", Symbol: "A"}, {Name: "B", Symbol: "B"}}, Sources: []models.Source{{ID: "source", SourceKey: &key, Enabled: true, ArticleLimit: 2}}}}
|
||||
uc := generation.NewUseCase(generation.Dependencies{Repository: repo, SummaryResolver: &ticket17HTTPResolver{provider: summary}, LayaRanker: ranker, Scrapers: map[string]scraper.Scraper{key: feed}})
|
||||
result, err := uc.Generate(context.Background(), "owner")
|
||||
if err != nil || calls != 2 || feed.calls != 1 {
|
||||
|
||||
Reference in New Issue
Block a user