Skip to content

Conversation

@subtleGradient
Copy link
Contributor

Add FileParserPlugin example for fetch API

  • 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

Fix biome linting issues in file-parser example

  • Use block statements for if condition
  • Replace template literal with string literal where interpolation not needed

Add PDF URL example and fix xlarge verification code

  • Add file-parser-pdf-url.ts demonstrating PDF URLs
  • Fix EXPECTED_CODES: xlarge code is W6H5V not F6H2V
  • All tests now pass (4/4)

Add shared fixtures module with JSON metadata

  • 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

Update generate-pdfs.sh to version with JSON metadata generation

  • Replace old script with version from ai-sdk-provider
  • New version generates JSON metadata files with verification codes
  • Supports TODO about dynamic randomization

Regenerate PDF fixtures with correct generate-pdfs.sh script

  • 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

Improve large.pdf OCR readability

  • 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

Copy link
Contributor Author

subtleGradient commented Nov 12, 2025

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@subtleGradient subtleGradient marked this pull request as ready for review November 12, 2025 21:37
Copilot AI review requested due to automatic review settings November 12, 2025 21:37
Copilot finished reviewing on behalf of subtleGradient November 12, 2025 21:42
Copy link

Copilot AI left a 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.

- 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
Copy link
Contributor Author

subtleGradient commented Nov 13, 2025

Merge activity

@subtleGradient subtleGradient changed the base branch from 02-prompt-caching-fetch to graphite-base/50 November 13, 2025 14:48
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.

3 participants