Skip to main content
Glama
josuekongolo

CompanyIQ MCP Server

by josuekongolo
test-simple-parser.jsโ€ข3.2 kB
import { SimpleOpenAIParser } from './build/scraper/simple_openai_parser.js'; // Set OpenAI API key const OPENAI_API_KEY = "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"; async function testSimpleParser() { console.log('๐Ÿš€ Testing Simple OpenAI PDF Parser'); console.log('โ•'.repeat(50)); console.log('This will use GPT-4 to analyze text extracted from PDF'); console.log('โ•'.repeat(50) + '\n'); const parser = new SimpleOpenAIParser(OPENAI_API_KEY); // Use the 2024 PDF we already have const pdfPath = '/Users/josuekongolo/Downloads/aarsregnskap_999059198-2024.pdf'; console.log(`๐Ÿ“„ Testing with: ${pdfPath.split('/').pop()}`); console.log('โ”€'.repeat(50) + '\n'); try { const startTime = Date.now(); const result = await parser.parseFinancialPDF(pdfPath); const duration = Math.round((Date.now() - startTime) / 1000); console.log('\n' + 'โ•'.repeat(50)); console.log('๐Ÿ“Š FINAL RESULTS'); console.log('โ•'.repeat(50)); console.log(`\n๐Ÿ’ฐ Revenue: ${result.revenue ? (result.revenue / 1000000).toFixed(1) + 'M NOK' : 'Not found'}`); console.log(`๐Ÿ“Š Profit: ${result.profit ? (result.profit / 1000000).toFixed(1) + 'M NOK' : 'Not found'}`); console.log(`๐Ÿข Assets: ${result.assets ? (result.assets / 1000000).toFixed(1) + 'M NOK' : 'Not found'}`); console.log(`๐Ÿ’Ž Equity: ${result.equity ? (result.equity / 1000000).toFixed(1) + 'M NOK' : 'Not found'}`); console.log(`\nโฑ๏ธ Time taken: ${duration} seconds`); if (result.revenue || result.profit || result.assets || result.equity) { console.log('\nโœ… SUCCESS! Simple OpenAI extracted financial data!'); // Compare with expected values from API console.log('\n๐Ÿ“‹ Expected values for 2024 (from API):'); console.log(' Revenue: 831.0M NOK'); console.log(' Profit: 81.3M NOK'); console.log(' Assets: 594.6M NOK'); console.log(' Equity: 128.8M NOK'); // Calculate accuracy if (result.revenue) { const revAccuracy = (100 - Math.abs(result.revenue - 831000000) / 831000000 * 100).toFixed(1); console.log(`\n๐Ÿ“ˆ Revenue extraction accuracy: ${revAccuracy}%`); } if (result.profit) { const profitAccuracy = (100 - Math.abs(result.profit - 81300000) / 81300000 * 100).toFixed(1); console.log(`๐Ÿ“ˆ Profit extraction accuracy: ${profitAccuracy}%`); } } else { console.log('\nโš ๏ธ No financial data extracted.'); console.log('Possible reasons:'); console.log('- PDF is pure image (scanned) with no text layer'); console.log('- OpenAI API key might be invalid'); console.log('- GPT-4 might need better prompting'); } } catch (error) { console.error('\nโŒ Test failed:', error.message || error); console.error('\nMake sure:'); console.error('1. The OpenAI API key is valid'); console.error('2. You have GPT-4 access'); console.error('3. The PDF file exists'); } console.log('\n' + 'โ•'.repeat(50)); console.log('Test complete!\n'); } testSimpleParser();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/josuekongolo/companyiq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server