Files
cim_summary/backend/test-llm-processing.js
Jon df079713c4 feat: Complete cloud-native CIM Document Processor with full BPCP template
🌐 Cloud-Native Architecture:
- Firebase Functions deployment (no Docker)
- Supabase database (replacing local PostgreSQL)
- Google Cloud Storage integration
- Document AI + Agentic RAG processing pipeline
- Claude-3.5-Sonnet LLM integration

 Full BPCP CIM Review Template (7 sections):
- Deal Overview
- Business Description
- Market & Industry Analysis
- Financial Summary (with historical financials table)
- Management Team Overview
- Preliminary Investment Thesis
- Key Questions & Next Steps

🔧 Cloud Migration Improvements:
- PostgreSQL → Supabase migration complete
- Local storage → Google Cloud Storage
- Docker deployment → Firebase Functions
- Schema mapping fixes (camelCase/snake_case)
- Enhanced error handling and logging
- Vector database with fallback mechanisms

📄 Complete End-to-End Cloud Workflow:
1. Upload PDF → Document AI extraction
2. Agentic RAG processing → Structured CIM data
3. Store in Supabase → Vector embeddings
4. Auto-generate PDF → Full BPCP template
5. Download complete CIM review

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:51:45 -04:00

71 lines
2.5 KiB
JavaScript

const { llmService } = require('./dist/services/llmService.js');
async function testLLM() {
console.log('🧪 Testing LLM service with simple document...');
const testText = `
CONFIDENTIAL INFORMATION MEMORANDUM
RESTORATION SYSTEMS INC.
Target Company Name: Restoration Systems Inc.
Industry: Building Services / Restoration
Geography: Ohio, USA
Revenue (LTM): $25.0 Million
EBITDA (LTM): $4.2 Million
Employee Count: 85 employees
Business Description:
Restoration Systems Inc. is a leading provider of water damage restoration and remediation services across Ohio. The company serves both residential and commercial customers, offering 24/7 emergency response services.
Key Products/Services:
- Water damage restoration (60% of revenue)
- Fire damage restoration (25% of revenue)
- Mold remediation (15% of revenue)
Financial Performance:
FY-2: Revenue $20.0M, EBITDA $3.0M
FY-1: Revenue $22.5M, EBITDA $3.6M
LTM: Revenue $25.0M, EBITDA $4.2M
Management Team:
- CEO: John Smith (15 years experience)
- CFO: Mary Johnson (8 years experience)
Key Customers: Mix of insurance companies and direct customers
Market Size: $30B nationally
`;
try {
console.log('📤 Calling LLM service...');
const result = await llmService.processCIMDocument(testText, 'BPCP CIM Review Template');
console.log('✅ LLM processing completed');
console.log('Success:', result.success);
console.log('Model:', result.model);
console.log('Cost:', result.cost);
if (result.success && result.jsonOutput) {
console.log('📋 JSON Output Fields:');
console.log('- Deal Overview:', Object.keys(result.jsonOutput.dealOverview || {}));
console.log('- Business Description:', Object.keys(result.jsonOutput.businessDescription || {}));
console.log('- Financial Summary:', Object.keys(result.jsonOutput.financialSummary || {}));
console.log('📝 Sample extracted data:');
console.log('- Target Company:', result.jsonOutput.dealOverview?.targetCompanyName);
console.log('- Industry:', result.jsonOutput.dealOverview?.industrySector);
console.log('- LTM Revenue:', result.jsonOutput.financialSummary?.financials?.ltm?.revenue);
console.log('- Employee Count:', result.jsonOutput.dealOverview?.employeeCount);
} else {
console.log('❌ LLM processing failed');
console.log('Error:', result.error);
console.log('Validation Issues:', result.validationIssues);
}
} catch (error) {
console.log('❌ Test failed:', error.message);
console.log('Error details:', error);
}
}
testLLM();