feat(ingest): submit async extraction batches from the ingest loop (#430) - #434
Merged
Conversation
) Completes #420's ingest wiring. With EXTRACTION_BATCH + the Claude extractor (c.batchExtractor set), ingest's extractor step submits the document's hot chunks as one Message Batch (SubmitExtractionBatch, custom_id = content hash, deduped) instead of extracting synchronously per chunk — so a bulk import defers node/edge creation to `kb poll-batches` (cron) at ~50% of the API cost. IngestStats.BatchesSubmitted counts it; ExtractedNodes/Edges stay 0 for that document (the graph is written at poll time). The synchronous path is unchanged when batch mode is off (default). Batches are per-document; coalescing across a run is a minor future optimization. Cross-doc entity resolution remains #431. Test: TestIngestSubmitsBatch (DB + capturing mock) — ingest submits a batch and writes no graph, then poll-batches applies the extraction. Closes #430 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #430 — completes #420's ingest wiring. Opt-in (
EXTRACTION_BATCH), sync path unchanged by default.With
EXTRACTION_BATCH+ the Claude extractor, ingest's extractor step now submits the document's hot chunks as one Message Batch (SubmitExtractionBatch, custom_id = content hash, deduped) instead of extracting synchronously per chunk — so a bulk import defers node/edge creation tokb poll-batches(cron) at ~50% of the API cost.IngestStats.BatchesSubmittedcounts it;ExtractedNodes/Edgesstay 0 for that document (graph written at poll time).Test
TestIngestSubmitsBatch(DB + capturing mock): ingest submits a batch and writes no graph, thenpoll-batchesapplies the extraction (nodes appear).gofmt/vet/golangci-lintclean. SYSTEM.md (§10) updated.🤖 Generated with Claude Code