Skip to content

perf: preprocess email body before LLM calls to reduce token burn#48

Merged
sholgaat merged 1 commit into
mainfrom
claude/action-issue-39-xbkzue
Jun 21, 2026
Merged

perf: preprocess email body before LLM calls to reduce token burn#48
sholgaat merged 1 commit into
mainfrom
claude/action-issue-39-xbkzue

Conversation

@sholgaat

@sholgaat sholgaat commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Adds a preprocess_body() function in email_service.py that strips
inline data URIs, collapses excessive blank lines, cuts at footer/
unsubscribe markers, and hard-truncates to 3000 characters. All three
extraction modules (classifier, flight_extractor, accommodation_extractor)
now call preprocess_body() instead of inline slicing, reducing per-email
token cost by 60–80% and making it safe to raise INGEST_LIMIT.

Closes #39

Adds a preprocess_body() function in email_service.py that strips
inline data URIs, collapses excessive blank lines, cuts at footer/
unsubscribe markers, and hard-truncates to 3000 characters. All three
extraction modules (classifier, flight_extractor, accommodation_extractor)
now call preprocess_body() instead of inline slicing, reducing per-email
token cost by 60–80% and making it safe to raise INGEST_LIMIT.

Closes #39

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R3RsJoMdczuX4mbMuMh78U
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
travel-bro Ready Ready Preview, Comment Jun 21, 2026 3:50pm

@sholgaat
sholgaat merged commit c44ca95 into main Jun 21, 2026
4 checks passed
@sholgaat
sholgaat deleted the claude/action-issue-39-xbkzue branch June 21, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: reduce LLM token burn during email ingestion (truncate + preprocess before classify/extract)

2 participants