Replace embedding/DBSCAN aggregation with LLM-based pipeline #12

Manually merged
marvin8 merged 3 commits from feat/issue-1-llm-aggregation into main 2026-09-11 04:17:28 +00:00
Collaborator

What

Replace the embedding + DBSCAN article aggregation pipeline with a single cloud-LLM call per run.

Changes

  • Remove: EmbeddingPipeline, AggregationService, embedder.py, aggregator.py, db/embeddings.py
  • Remove: sentence-transformers, scikit-learn, numpy — eliminates ~42 CUDA transitive deps (~1 GB)
  • Add: LlmAggregationService using OpenAI-compatible /chat/completions endpoint (configured via YUNJIN_LLM_API_KEY, YUNJIN_LLM_BASE_URL, YUNJIN_LLM_MODEL)
  • Incremental aggregation: new articles matched against existing aggregates; stale aggregates (no new article for N days) are expired
  • Migration: drop embeddings table, add index on aggregates.updated_at
  • CLI: --refresh (was --recalculate), --aggregate-ttl-days; remove --eps and --min-samples

Tests

27 unit and integration tests for LlmAggregationService (all passing, no live API calls).

Closes #1

## What Replace the embedding + DBSCAN article aggregation pipeline with a single cloud-LLM call per run. ## Changes - **Remove:** `EmbeddingPipeline`, `AggregationService`, `embedder.py`, `aggregator.py`, `db/embeddings.py` - **Remove:** `sentence-transformers`, `scikit-learn`, `numpy` — eliminates ~42 CUDA transitive deps (~1 GB) - **Add:** `LlmAggregationService` using OpenAI-compatible `/chat/completions` endpoint (configured via `YUNJIN_LLM_API_KEY`, `YUNJIN_LLM_BASE_URL`, `YUNJIN_LLM_MODEL`) - Incremental aggregation: new articles matched against existing aggregates; stale aggregates (no new article for N days) are expired - **Migration:** drop `embeddings` table, add index on `aggregates.updated_at` - **CLI:** `--refresh` (was `--recalculate`), `--aggregate-ttl-days`; remove `--eps` and `--min-samples` ## Tests 27 unit and integration tests for `LlmAggregationService` (all passing, no live API calls). Closes #1
Replace embedding/DBSCAN aggregation with LLM-based pipeline
All checks were successful
/ pr-review (pull_request) Successful in 5s
/ gitleaks (pull_request) Successful in 18s
/ checks (pull_request) Successful in 2m42s
424e5895f8
- Remove EmbeddingPipeline + AggregationService (DBSCAN)
- Remove db/embeddings.py data access layer
- Drop sentence-transformers, scikit-learn, numpy — eliminates all nvidia CUDA
  transitive deps (~42 packages, ~1 GB)
- Add LlmAggregationService using httpx calls to any OpenAI-compatible
  /chat/completions endpoint (YUNJIN_LLM_API_KEY, YUNJIN_LLM_BASE_URL,
  YUNJIN_LLM_MODEL env vars)
- Incremental aggregation: new articles matched against existing aggregates;
  stale aggregates (no new article for N days) are expired
- Migration: drop embeddings table, add index on aggregates.updated_at
- Rewrite CLI: --refresh (was --recalculate), --aggregate-ttl-days;
  remove --eps and --min-samples
- Rewrite test_aggregator.py with httpx mock fixtures

Refs #1

This PR is too large to review automatically (5021 lines; limit is 2000). Please consider splitting it into smaller PRs.

This PR is too large to review automatically (5021 lines; limit is 2000). Please consider splitting it into smaller PRs.
marvin8 approved these changes 2026-09-11 03:13:14 +00:00
Dismissed
📝 Improve aggregation prompt: group by individual news story not broad topic
Some checks failed
/ pr-review (pull_request) Successful in 4s
/ gitleaks (pull_request) Successful in 13s
/ checks (pull_request) Failing after 2m42s
e6226d5683
agent-pi dismissed marvin8's review 2026-09-11 03:44:21 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

This PR is too large to review automatically (5036 lines; limit is 2000). Please consider splitting it into smaller PRs.

This PR is too large to review automatically (5036 lines; limit is 2000). Please consider splitting it into smaller PRs.
🚨 Fix ruff violations in test file and wsgi.py
All checks were successful
/ pr-review (pull_request) Successful in 5s
/ gitleaks (pull_request) Successful in 13s
/ checks (pull_request) Successful in 2m41s
71c49de41f

This PR is too large to review automatically (4998 lines; limit is 2000). Please consider splitting it into smaller PRs.

This PR is too large to review automatically (4998 lines; limit is 2000). Please consider splitting it into smaller PRs.
marvin8 approved these changes 2026-09-11 04:16:15 +00:00
marvin8 manually merged commit 819d86a952 into main 2026-09-11 04:17:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/yunjin!12
No description provided.