Skip to content

Commit bd24657

Browse files
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
1 parent e3a9a85 commit bd24657

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

typescript/ai-sdk-v5/src/plugin-file-parser/file-parser-all-sizes.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* PDFs are sent as file attachments and automatically parsed server-side.
66
*
77
* Key Points:
8-
* - FileParserPlugin automatically enabled for file attachments
8+
* - FileParserPlugin explicitly configured for models without native PDF support
99
* - PDFs sent via data URI format
1010
* - Tests multiple PDF sizes with verification code extraction
1111
* - Uses shared fixtures module with absolute paths
@@ -29,7 +29,8 @@ const openrouter = createOpenRouter({
2929
apiKey: process.env.OPENROUTER_API_KEY,
3030
});
3131

32-
const MODEL = 'anthropic/claude-3.5-sonnet';
32+
// Use a model that doesn't have native PDF support to demonstrate FileParserPlugin
33+
const MODEL = 'openai/gpt-4o-mini';
3334

3435
/**
3536
* Process a single PDF with FileParserPlugin
@@ -42,7 +43,17 @@ async function testPdf(size: PdfSize, expectedCode: string): Promise<boolean> {
4243
console.log(`Size: ${formatSize(fileSize)}`);
4344
console.log(`Expected: ${expectedCode}`);
4445

45-
const model = openrouter(MODEL, { usage: { include: true } });
46+
const model = openrouter(MODEL, {
47+
plugins: [
48+
{
49+
id: 'file-parser',
50+
pdf: {
51+
engine: 'mistral-ocr',
52+
},
53+
},
54+
],
55+
usage: { include: true },
56+
});
4657

4758
const result = await generateText({
4859
model,

0 commit comments

Comments
 (0)