Node.js Lease PDF Search: Budget Embeddings, Rerank, and Final Summary
Описание и применение
Сервис Node.js для резюмирования длинных договоров аренды использует цепочку извлечения, ранжирования и генерации. Новая система логирования фиксирует количество кандидатов, выбранных фрагментов и метрики каждого этапа, позволяя быстро выявлять нарушения бюджета и устранять проблемы до того, как они повлияют на итоговый суммарный расход.
Задача
On‑call engineers only see a property ID, document ID, and a rising total after a lease‑PDF summarization workflow, missing early signals that retrieval admitted too many chunks and the final summary inherited unnecessary context.
Результат
The new instrumentation reduces downstream token exposure, makes provider portability an operational property, and provides actionable alerts on evidence budget violations rather than only cost totals.
Рабочий процесс
- Index lease PDF into page‑aware chunks with embeddings
- Retrieve broadly based on semantic search
- Rerank candidate set to select top passages
- Generate final summary using selected passages
- Record metrics at each boundary (retrieval, rerank, generation)
- Alert on budget invariant violations
Доказательства
The useful signal fired several steps earlier, when retrieval admitted too many chunks and the final summary inherited a context it never needed.
Store stable application fields in Postgres: document_version, chunk_id, page range, text digest, embedding model identifier, and index timestamp.
The final-generation record needs selected count and input-token count, plus the provider, latency, cost, and request ID where the provider supplies them.
- Дата записи: 2026-10-01T22:40:51.919Z