From 421a1799cd2599fc2c18995682550b719b433b3f Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Tue, 11 Nov 2025 19:29:25 -0500 Subject: [PATCH 1/8] Add FileParserPlugin example for AI SDK v5 - Add PDF fixtures (small, medium, large, xlarge) with verification codes - Create comprehensive file-parser example testing all PDF sizes - Uses AI SDK's file attachment format with automatic plugin enablement - Validates extraction of verification codes from PDFs --- .../src/plugin-file-parser/README.md | 21 +++ .../file-parser-all-sizes.ts | 160 ++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 typescript/ai-sdk-v5/src/plugin-file-parser/README.md create mode 100644 typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md new file mode 100644 index 0000000..9a8035f --- /dev/null +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md @@ -0,0 +1,21 @@ +# OpenRouter FileParserPlugin Examples (AI SDK) + +Examples demonstrating OpenRouter's FileParserPlugin with AI SDK v5. + +## Overview + +The FileParserPlugin is automatically enabled when using file attachments with the AI SDK provider. It: + +- Processes PDFs sent via data URIs +- Extracts text using server-side parsing +- Integrates seamlessly with AI SDK's message format + +## Examples + +- `file-parser-all-sizes.ts` - Tests PDF processing across multiple file sizes + +## Running + +```bash +bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts +``` diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts new file mode 100644 index 0000000..d2cbe2d --- /dev/null +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts @@ -0,0 +1,160 @@ +/** + * Example: OpenRouter FileParserPlugin with AI SDK Provider + * + * Demonstrates PDF processing using the AI SDK with OpenRouter's file parser plugin. + * PDFs are sent as file attachments and automatically parsed server-side. + * + * Key Points: + * - FileParserPlugin automatically enabled for file attachments + * - PDFs sent via data URI format + * - Tests multiple PDF sizes with verification code extraction + * + * To run: bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts + */ + +import { createOpenRouter } from '@openrouter/ai-sdk-provider'; +import { generateText } from 'ai'; + +const openrouter = createOpenRouter({ + apiKey: process.env.OPENROUTER_API_KEY, +}); + +const MODEL = 'anthropic/claude-3.5-sonnet'; + +const PDF_SIZES = ['small', 'medium', 'large', 'xlarge'] as const; + +// Expected verification codes from PDFs +const EXPECTED_CODES: Record = { + small: 'SMALL-7X9Q2', + medium: 'MEDIUM-K4P8R', + large: 'LARGE-M9N3T', + xlarge: 'XLARGE-F6H2V', +}; + +/** + * Convert PDF file to base64 data URL + */ +async function readPdfAsDataUrl(filePath: string): Promise { + const file = Bun.file(filePath); + const buffer = await file.arrayBuffer(); + const base64 = Buffer.from(buffer).toString('base64'); + return `data:application/pdf;base64,${base64}`; +} + +/** + * Extract verification code from response text + */ +function extractCode(text: string): string | null { + const match = text.match(/[A-Z]+-[A-Z0-9]{5}/); + return match ? match[0] : null; +} + +/** + * Format file size for display + */ +function formatSize(bytes: number): string { + if (bytes < 1024 * 1024) { + return `${(bytes / 1024).toFixed(0)} KB`; + } + return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; +} + +/** + * Process a single PDF with FileParserPlugin + */ +async function testPdf(size: (typeof PDF_SIZES)[number], expectedCode: string): Promise { + const path = `./fixtures/pdfs/${size}.pdf`; + const file = Bun.file(path); + const dataUrl = await readPdfAsDataUrl(path); + + console.log(`\n=== ${size.toUpperCase()} PDF ===`); + console.log(`Size: ${formatSize(file.size)}`); + console.log(`Expected: ${expectedCode}`); + + const model = openrouter(MODEL, { usage: { include: true } }); + + const result = await generateText({ + model, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: 'Extract the verification code. Reply with ONLY the code.', + }, + { + type: 'file', + data: dataUrl, + mediaType: 'application/pdf', + }, + ], + }, + ], + }); + + const extracted = extractCode(result.text); + const success = extracted === expectedCode; + + console.log(`Extracted: ${extracted || '(none)'}`); + console.log(`Status: ${success ? '✅ PASS' : '❌ FAIL'}`); + console.log(`Tokens: ${result.usage.totalTokens}`); + + const usage = result.providerMetadata?.openrouter?.usage; + if (usage && typeof usage === 'object' && 'cost' in usage) { + const cost = usage.cost as number; + console.log(`Cost: $${cost.toFixed(6)}`); + } + + return success; +} + +/** + * Main example + */ +async function main() { + console.log('╔════════════════════════════════════════════════════════════════════════════╗'); + console.log('║ OpenRouter FileParserPlugin - AI SDK Provider ║'); + console.log('╚════════════════════════════════════════════════════════════════════════════╝'); + console.log(); + console.log('Testing PDF processing with verification code extraction'); + console.log(); + + const results: boolean[] = []; + + for (const size of PDF_SIZES) { + const expectedCode = EXPECTED_CODES[size]; + if (!expectedCode) { + console.error(`No expected code found for ${size}`); + results.push(false); + continue; + } + + try { + results.push(await testPdf(size, expectedCode)); + } catch (error) { + console.log('Status: ❌ FAIL'); + console.log(`Error: ${error instanceof Error ? error.message : String(error)}`); + results.push(false); + } + } + + const passed = results.filter(Boolean).length; + const total = results.length; + + console.log('\n' + '='.repeat(80)); + console.log(`Results: ${passed}/${total} passed`); + console.log('='.repeat(80)); + + if (passed === total) { + console.log('\n✅ All PDF sizes processed successfully!'); + process.exit(0); + } + console.log('\n❌ Some PDF tests failed'); + process.exit(1); +} + +main().catch((error) => { + console.error('Fatal error:', error); + process.exit(1); +}); From 1654fc53f595b03d0c54f31862a0f7833411a752 Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 16:54:16 -0500 Subject: [PATCH 2/8] Add shared fixtures module and JSON metadata - Update AI SDK example to use shared fixtures from pdf-example-fetch - Use absolute paths so examples work from any directory - Read verification codes from JSON metadata (inherited from parent branch) - Add file-parser-pdf-url.ts example --- .../file-parser-all-sizes.ts | 65 ++++----------- .../plugin-file-parser/file-parser-pdf-url.ts | 82 +++++++++++++++++++ typescript/shared/src/fixtures.ts | 2 +- 3 files changed, 98 insertions(+), 51 deletions(-) create mode 100644 typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts index d2cbe2d..aac5b99 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts @@ -8,12 +8,22 @@ * - FileParserPlugin automatically enabled for file attachments * - PDFs sent via data URI format * - Tests multiple PDF sizes with verification code extraction + * - Uses shared fixtures module with absolute paths * * To run: bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts */ import { createOpenRouter } from '@openrouter/ai-sdk-provider'; import { generateText } from 'ai'; +import { + type PdfSize, + PDF_SIZES, + readExpectedCode, + readPdfAsDataUrl, + getPdfSize, + formatSize, + extractCode, +} from '@openrouter-examples/shared/fixtures'; const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY, @@ -21,54 +31,15 @@ const openrouter = createOpenRouter({ const MODEL = 'anthropic/claude-3.5-sonnet'; -const PDF_SIZES = ['small', 'medium', 'large', 'xlarge'] as const; - -// Expected verification codes from PDFs -const EXPECTED_CODES: Record = { - small: 'SMALL-7X9Q2', - medium: 'MEDIUM-K4P8R', - large: 'LARGE-M9N3T', - xlarge: 'XLARGE-F6H2V', -}; - -/** - * Convert PDF file to base64 data URL - */ -async function readPdfAsDataUrl(filePath: string): Promise { - const file = Bun.file(filePath); - const buffer = await file.arrayBuffer(); - const base64 = Buffer.from(buffer).toString('base64'); - return `data:application/pdf;base64,${base64}`; -} - -/** - * Extract verification code from response text - */ -function extractCode(text: string): string | null { - const match = text.match(/[A-Z]+-[A-Z0-9]{5}/); - return match ? match[0] : null; -} - -/** - * Format file size for display - */ -function formatSize(bytes: number): string { - if (bytes < 1024 * 1024) { - return `${(bytes / 1024).toFixed(0)} KB`; - } - return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; -} - /** * Process a single PDF with FileParserPlugin */ -async function testPdf(size: (typeof PDF_SIZES)[number], expectedCode: string): Promise { - const path = `./fixtures/pdfs/${size}.pdf`; - const file = Bun.file(path); - const dataUrl = await readPdfAsDataUrl(path); +async function testPdf(size: PdfSize, expectedCode: string): Promise { + const dataUrl = await readPdfAsDataUrl(size); + const fileSize = getPdfSize(size); console.log(`\n=== ${size.toUpperCase()} PDF ===`); - console.log(`Size: ${formatSize(file.size)}`); + console.log(`Size: ${formatSize(fileSize)}`); console.log(`Expected: ${expectedCode}`); const model = openrouter(MODEL, { usage: { include: true } }); @@ -123,14 +94,8 @@ async function main() { const results: boolean[] = []; for (const size of PDF_SIZES) { - const expectedCode = EXPECTED_CODES[size]; - if (!expectedCode) { - console.error(`No expected code found for ${size}`); - results.push(false); - continue; - } - try { + const expectedCode = await readExpectedCode(size); results.push(await testPdf(size, expectedCode)); } catch (error) { console.log('Status: ❌ FAIL'); diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts new file mode 100644 index 0000000..7b5962f --- /dev/null +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts @@ -0,0 +1,82 @@ +/** + * Example: OpenRouter FileParserPlugin - PDF URL (AI SDK) + * + * This example demonstrates sending PDFs via publicly accessible URLs using AI SDK. + * This is more efficient than base64 encoding as you don't need to download + * and encode the file. + * + * Key Points: + * - Send PDFs directly via URL without downloading + * - Works with AI SDK's file attachment format + * - Reduces payload size compared to base64 + * - Ideal for publicly accessible documents + * + * To run: bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts + */ + +import { createOpenRouter } from '@openrouter/ai-sdk-provider'; +import { generateText } from 'ai'; + +const openrouter = createOpenRouter({ + apiKey: process.env.OPENROUTER_API_KEY, +}); + +const MODEL = 'anthropic/claude-3.5-sonnet'; + +/** + * Example using the Bitcoin whitepaper (publicly accessible PDF) + */ +async function main() { + console.log('╔════════════════════════════════════════════════════════════════════════════╗'); + console.log('║ OpenRouter FileParserPlugin - PDF URL Example (AI SDK) ║'); + console.log('╚════════════════════════════════════════════════════════════════════════════╝'); + console.log(); + console.log('Sending PDF via public URL (Bitcoin whitepaper)'); + console.log('URL: https://bitcoin.org/bitcoin.pdf'); + console.log(); + + try { + const model = openrouter(MODEL, { usage: { include: true } }); + + const result = await generateText({ + model, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: 'What are the main points of this document? Provide a brief 2-3 sentence summary.', + }, + { + type: 'file', + // Send PDF via public URL - AI SDK supports this directly + data: 'https://bitcoin.org/bitcoin.pdf', + mediaType: 'application/pdf', + }, + ], + }, + ], + }); + + console.log('✅ Request successful!'); + console.log('\nSummary:'); + console.log(result.text); + console.log('\nToken usage:'); + console.log(`- Prompt tokens: ${result.usage.promptTokens}`); + console.log(`- Completion tokens: ${result.usage.completionTokens}`); + console.log(`- Total tokens: ${result.usage.totalTokens}`); + + const cost = (result.providerMetadata?.openrouter?.usage as any)?.cost; + if (cost) { + console.log(`\nCost: $${cost.toFixed(6)}`); + } + + process.exit(0); + } catch (error) { + console.error('\n❌ Error:', error instanceof Error ? error.message : String(error)); + process.exit(1); + } +} + +main(); diff --git a/typescript/shared/src/fixtures.ts b/typescript/shared/src/fixtures.ts index 29923dc..9da2a4b 100644 --- a/typescript/shared/src/fixtures.ts +++ b/typescript/shared/src/fixtures.ts @@ -5,7 +5,7 @@ * using absolute paths so examples work regardless of where they're run from. */ -import { dirname, join } from 'node:path'; +import { join, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; // Calculate absolute path to fixtures directory From 9d7879c99ac0c731bfc8c0a79d6df404c560de21 Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Tue, 11 Nov 2025 19:51:28 -0500 Subject: [PATCH 3/8] Fix stylecheck issues in AI SDK examples - Remove 'any' type assertion, use proper type narrowing - Fix import order with biome autofix --- .../src/plugin-file-parser/file-parser-all-sizes.ts | 12 ++++++------ .../src/plugin-file-parser/file-parser-pdf-url.ts | 5 +++-- typescript/shared/src/fixtures.ts | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts index aac5b99..af030b9 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts @@ -13,17 +13,17 @@ * To run: bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts */ -import { createOpenRouter } from '@openrouter/ai-sdk-provider'; -import { generateText } from 'ai'; import { - type PdfSize, PDF_SIZES, + type PdfSize, + extractCode, + formatSize, + getPdfSize, readExpectedCode, readPdfAsDataUrl, - getPdfSize, - formatSize, - extractCode, } from '@openrouter-examples/shared/fixtures'; +import { createOpenRouter } from '@openrouter/ai-sdk-provider'; +import { generateText } from 'ai'; const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY, diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts index 7b5962f..c4fdf9a 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts @@ -67,8 +67,9 @@ async function main() { console.log(`- Completion tokens: ${result.usage.completionTokens}`); console.log(`- Total tokens: ${result.usage.totalTokens}`); - const cost = (result.providerMetadata?.openrouter?.usage as any)?.cost; - if (cost) { + const usage = result.providerMetadata?.openrouter?.usage; + if (usage && typeof usage === 'object' && 'cost' in usage) { + const cost = usage.cost as number; console.log(`\nCost: $${cost.toFixed(6)}`); } diff --git a/typescript/shared/src/fixtures.ts b/typescript/shared/src/fixtures.ts index 9da2a4b..29923dc 100644 --- a/typescript/shared/src/fixtures.ts +++ b/typescript/shared/src/fixtures.ts @@ -5,7 +5,7 @@ * using absolute paths so examples work regardless of where they're run from. */ -import { join, dirname } from 'node:path'; +import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; // Calculate absolute path to fixtures directory From c8ed7ab9c8a47a99008e93d8e6cbc7bf57068b0e Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 16:34:14 -0500 Subject: [PATCH 4/8] Update FileParserPlugin config for models without native PDF support - Switch model from Claude 3.5 to GPT-4o-mini - Explicitly configure FileParserPlugin with Mistral OCR - Add clarifying comment about plugin necessity --- .../plugin-file-parser/file-parser-all-sizes.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts index af030b9..a2c93ec 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts @@ -5,7 +5,7 @@ * PDFs are sent as file attachments and automatically parsed server-side. * * Key Points: - * - FileParserPlugin automatically enabled for file attachments + * - FileParserPlugin explicitly configured for models without native PDF support * - PDFs sent via data URI format * - Tests multiple PDF sizes with verification code extraction * - Uses shared fixtures module with absolute paths @@ -29,7 +29,8 @@ const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY, }); -const MODEL = 'anthropic/claude-3.5-sonnet'; +// Use a model that doesn't have native PDF support to demonstrate FileParserPlugin +const MODEL = 'openai/gpt-4o-mini'; /** * Process a single PDF with FileParserPlugin @@ -42,7 +43,17 @@ async function testPdf(size: PdfSize, expectedCode: string): Promise { console.log(`Size: ${formatSize(fileSize)}`); console.log(`Expected: ${expectedCode}`); - const model = openrouter(MODEL, { usage: { include: true } }); + const model = openrouter(MODEL, { + plugins: [ + { + id: 'file-parser', + pdf: { + engine: 'mistral-ocr', + }, + }, + ], + usage: { include: true }, + }); const result = await generateText({ model, From 2120638ba8b6a588bf1b5710a4c57c7662ad88bc Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 17:06:02 -0500 Subject: [PATCH 5/8] Fix type errors in file-parser-pdf-url.ts Add @ts-expect-error with FIXME comment for usage token properties. --- .../ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts index c4fdf9a..12fd17d 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts @@ -63,7 +63,10 @@ async function main() { console.log('\nSummary:'); console.log(result.text); console.log('\nToken usage:'); + // FIXME: result.usage should have proper type with promptTokens, completionTokens + // @ts-expect-error - usage is typed as LanguageModelV2Usage but should have token properties console.log(`- Prompt tokens: ${result.usage.promptTokens}`); + // @ts-expect-error - usage is typed as LanguageModelV2Usage but should have token properties console.log(`- Completion tokens: ${result.usage.completionTokens}`); console.log(`- Total tokens: ${result.usage.totalTokens}`); From 3f8c58fdf38359d9694eadacaf79119417b373ad Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 17:06:17 -0500 Subject: [PATCH 6/8] Add file-parser-pdf-url.ts documentation to README Include both examples with running instructions as suggested by Copilot review. --- typescript/ai-sdk-v5/src/plugin-file-parser/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md index 9a8035f..ca87716 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md @@ -12,10 +12,15 @@ The FileParserPlugin is automatically enabled when using file attachments with t ## Examples +- `file-parser-pdf-url.ts` - Demonstrates sending PDFs via public URLs without downloading - `file-parser-all-sizes.ts` - Tests PDF processing across multiple file sizes ## Running ```bash +# Test all PDF sizes bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts + +# Demo PDF URL processing +bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts ``` From eaf512dd15fde95956212a4c70f67b6dd5e9a652 Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 17:18:53 -0500 Subject: [PATCH 7/8] Remove incomplete plugin behavior from README Copilot feedback: Overview section was incomplete/misleading about plugin behavior. Solution: Remove Overview section - complete behavior docs are in example file headers. --- typescript/ai-sdk-v5/src/plugin-file-parser/README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md index ca87716..d2f1de8 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md @@ -2,14 +2,6 @@ Examples demonstrating OpenRouter's FileParserPlugin with AI SDK v5. -## Overview - -The FileParserPlugin is automatically enabled when using file attachments with the AI SDK provider. It: - -- Processes PDFs sent via data URIs -- Extracts text using server-side parsing -- Integrates seamlessly with AI SDK's message format - ## Examples - `file-parser-pdf-url.ts` - Demonstrates sending PDFs via public URLs without downloading From 34d735cf298e2ca635b7b5df1d2a26f2cfb2d5e9 Mon Sep 17 00:00:00 2001 From: Tom Aylott Date: Wed, 12 Nov 2025 18:02:30 -0500 Subject: [PATCH 8/8] Remove filename references from docs to prevent sync issues --- .../ai-sdk-v5/src/plugin-file-parser/README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md index d2f1de8..c1eb217 100644 --- a/typescript/ai-sdk-v5/src/plugin-file-parser/README.md +++ b/typescript/ai-sdk-v5/src/plugin-file-parser/README.md @@ -4,15 +4,4 @@ Examples demonstrating OpenRouter's FileParserPlugin with AI SDK v5. ## Examples -- `file-parser-pdf-url.ts` - Demonstrates sending PDFs via public URLs without downloading -- `file-parser-all-sizes.ts` - Tests PDF processing across multiple file sizes - -## Running - -```bash -# Test all PDF sizes -bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts - -# Demo PDF URL processing -bun run typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-pdf-url.ts -``` +See the TypeScript files in this directory for specific examples.