-
Notifications
You must be signed in to change notification settings - Fork 43
Add FileParserPlugin example for fetch API #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: graphite-base/50
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive FileParserPlugin examples for the fetch API, demonstrating PDF processing capabilities with various file sizes and formats. The implementation includes a shared fixtures module, example scripts, and test PDFs with embedded verification codes for validation.
- Introduces a shared fixtures utility module for managing PDF test files and metadata
- Adds two example scripts: one for processing PDFs via public URLs and another for testing multiple PDF sizes
- Includes generated PDF fixtures (small, medium, large, xlarge) with JSON metadata and verification codes
Reviewed Changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| typescript/shared/src/fixtures.ts | New utility module providing file path resolution, metadata reading, and PDF processing helpers using Bun APIs |
| typescript/shared/package.json | Adds exports entry for the new fixtures module |
| typescript/fetch/src/plugin-file-parser/file-parser-pdf-url.ts | Example demonstrating PDF processing via public URLs using the Bitcoin whitepaper |
| typescript/fetch/src/plugin-file-parser/file-parser-all-sizes.ts | Comprehensive example testing PDF processing across multiple file sizes with verification code extraction |
| typescript/fetch/src/plugin-file-parser/README.md | Documentation for FileParserPlugin examples with usage instructions |
| fixtures/pdfs/*.json | JSON metadata files containing verification codes and descriptions for each test PDF |
| fixtures/pdfs/*.pdf | Generated test PDFs with embedded verification codes |
| fixtures/pdfs/generate-pdfs.sh | Shell script for generating test PDFs with ImageMagick |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
56a6d62 to
86e729c
Compare
- Add PDF fixtures (small, medium, large, xlarge) with verification codes - Create comprehensive file-parser example testing all PDF sizes - Uses mistral-ocr engine for PDF processing - Validates extraction of verification codes from PDFs
- Use block statements for if condition - Replace template literal with string literal where interpolation not needed
- Add file-parser-pdf-url.ts demonstrating PDF URLs - Fix EXPECTED_CODES: xlarge code is W6H5V not F6H2V - All tests now pass (4/4)
- Create shared/fixtures.ts with absolute path utilities - Read verification codes from JSON metadata (not hard-coded) - Add all PDF JSON metadata files from generate-pdfs.sh - Update fetch examples to use shared fixtures module - Add @ts-expect-error for missing 'provider' field in types - All examples now work from any directory using absolute paths - Tests: 4/4 passing for all-sizes example
- Replace old script with version from ai-sdk-provider - New version generates JSON metadata files with verification codes - Supports TODO about dynamic randomization
- Remove old codes.txt and README.md files - Regenerate all PDFs using updated generate-pdfs.sh from ai-sdk-provider - All PDFs validated successfully - All JSON metadata files validated successfully
- Increase verification code font size from 46pt to 96pt - Fixes OCR misreading M9N3T as M5N9T or MNGT - Update generate-pdfs.sh script with larger font - Tests: 4/4 passing across all SDKs
86e729c to
eb2df02
Compare
Merge activity
|

Add FileParserPlugin example for fetch API
Fix biome linting issues in file-parser example
Add PDF URL example and fix xlarge verification code
Add shared fixtures module with JSON metadata
Update generate-pdfs.sh to version with JSON metadata generation
Regenerate PDF fixtures with correct generate-pdfs.sh script
Improve large.pdf OCR readability