Add benchmarks and optimize Gmail analysis + policy batch processing (concurrency, retries, chunking)#9
Open
Mightyman14386 wants to merge 1 commit into
Conversation
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.
Motivation
Description
scripts/benchmark-gmail-parse.mjs,scripts/benchmark-gmail-pipeline.mjs, andscripts/benchmark-llm-analysis-optimization.mjs, and exposed them viapackage.json(bench:gmail-parse,bench:gmail-pipeline,bench:llm-analysis).LIST_PAGE_SIZE, fetch message metadata in parallel withFETCH_CONCURRENCY, usewithRetry(exponential backoff + jitter) around Gmail API calls, extract headers withextractRelevantHeaders, and stream progress logging while buildingparsedEmailsfor downstream processing.DEFAULT_POLICY_ANALYSISwhen LLM analysis is unavailable; results are still persisted in batches.chunkPoliciesForBatch) with per-item and per-batch char limits, addedanalyzePolicyChunksto iterate chunks against providers, reducedmax_tokens/maxOutputTokensto 1800, and map/merge results by domain (with logging); also madeextractJSONmore defensive.Testing
npm run bench:gmail-parse,npm run bench:gmail-pipeline, andnpm run bench:llm-analysisfor local performance validation.Codex Task