Files
cim_summary/test-agents-live.js
Jon 185c780486
Some checks failed
CI/CD Pipeline / Backend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Build Backend (push) Has been cancelled
CI/CD Pipeline / Build Frontend (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Performance Tests (push) Has been cancelled
CI/CD Pipeline / Dependency Updates (push) Has been cancelled
🚀 Update to Claude 3.7 latest and fix LLM processing issues
- Updated Anthropic API to latest version (2024-01-01)
- Set Claude 3.7 Sonnet Latest as primary model
- Removed deprecated Opus 3.5 references
- Fixed LLM response validation and JSON parsing
- Improved error handling and logging
- Updated model configurations and pricing
- Enhanced document processing reliability
- Fixed TypeScript type issues
- Updated environment configuration
2025-08-17 17:31:56 -04:00

102 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
// Test script to verify agents are working in the live testing environment
const https = require('https');
const API_BASE = 'https://us-central1-cim-summarizer-testing.cloudfunctions.net/api';
function makeRequest(path, options = {}) {
return new Promise((resolve, reject) => {
const url = new URL(API_BASE + path);
const requestOptions = {
hostname: url.hostname,
path: url.pathname + url.search,
method: options.method || 'GET',
headers: {
'Content-Type': 'application/json',
...options.headers
}
};
const req = https.request(requestOptions, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
try {
const jsonData = JSON.parse(data);
resolve({ status: res.statusCode, data: jsonData });
} catch (e) {
resolve({ status: res.statusCode, data: data });
}
});
});
req.on('error', reject);
if (options.body) {
req.write(JSON.stringify(options.body));
}
req.end();
});
}
async function testAgents() {
console.log('🧪 Testing Agentic RAG System in Live Environment...');
console.log('======================================================');
try {
// 1. Check health status
console.log('\n1⃣ Checking API Health...');
const health = await makeRequest('/health');
console.log(`Status: ${health.status}`);
console.log(`Response:`, health.data);
if (health.status !== 200) {
console.log('❌ API not healthy, aborting tests');
return;
}
// 2. Check recent documents to see if any have been processed
console.log('\n2⃣ Checking Recent Documents...');
try {
const docs = await makeRequest('/documents');
console.log(`Documents Status: ${docs.status}`);
console.log(`Documents Response:`, docs.data);
} catch (e) {
console.log('📋 Documents endpoint requires auth (expected)');
}
// 3. Check if we can hit the processing endpoint
console.log('\n3⃣ Testing Processing Endpoint Access...');
try {
const process = await makeRequest('/documents/test/process', { method: 'POST' });
console.log(`Process Status: ${process.status}`);
console.log(`Process Response:`, process.data);
} catch (e) {
console.log('🔧 Processing endpoint requires auth (expected)');
}
// 4. Check logs for recent LLM activity (if accessible)
console.log('\n4⃣ Checking System Configuration...');
// Check if the service is using the right configuration
const timestamp = new Date().toISOString();
console.log(`✅ Test completed at: ${timestamp}`);
console.log('\n📊 Results Summary:');
console.log(`- API Health: ${health.status === 200 ? '✅ HEALTHY' : '❌ UNHEALTHY'}`);
console.log(`- Environment: ${health.data?.environment || 'unknown'}`);
console.log(`- Version: ${health.data?.version || 'unknown'}`);
console.log('\n🔬 To test agents properly, we need to:');
console.log('1. Upload a test document through the frontend');
console.log('2. Monitor the Firebase Functions logs');
console.log('3. Check the Supabase database for processed results');
} catch (error) {
console.error('❌ Test failed:', error.message);
}
}
// Run the test
testAgents();