-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-llm-live.js
More file actions
81 lines (65 loc) · 3.19 KB
/
Copy pathtest-llm-live.js
File metadata and controls
81 lines (65 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* Direct test of LLM parser integration with the agent
* This script verifies that the agent uses the LLM parser directly
* with a real API call in development mode.
*/
import { createAgent } from './dist/server/agent.js';
async function testLiveLLMIntegration() {
console.log('🔥 Testing Live LLM Parser Integration');
console.log('=====================================');
// Use development mode to allow real API calls
process.env.NODE_ENV = 'development';
console.log('Environment:', process.env.NODE_ENV);
// Create the agent - this will now use our LLM parser directly
console.log('Creating agent...');
const agent = await createAgent();
console.log('Agent created');
// Test command with multiple checklist items
const command = "add milk in checklist and eggs in checklist too in Shopping List";
console.log('\nTesting command:', command);
// Process the command - will need confirmation
const initialResponse = await agent.chat(command);
console.log('\nInitial response:', initialResponse.content);
if (initialResponse.content.includes('CONFIRM?')) {
console.log('\n✅ Confirmation required, confirming...');
// Set confirmation flag and get final response
agent.set('confirm', true);
const finalResponse = await agent.chat('yes');
console.log('\nFinal response:', finalResponse.content);
// Check success
if (finalResponse.content.includes('milk') && finalResponse.content.includes('eggs')) {
console.log('\n✅ SUCCESS: Multiple checklist items detected and processed');
} else {
console.log('\n❌ FAILURE: Multiple checklist items not processed correctly');
}
} else {
console.log('\n⚠️ No confirmation required, checking result directly');
if (initialResponse.content.includes('milk') && initialResponse.content.includes('eggs')) {
console.log('\n✅ SUCCESS: Multiple checklist items detected and processed');
} else {
console.log('\n❌ FAILURE: Multiple checklist items not processed correctly');
}
}
// Test a more complex natural language command
const complexCommand = "add project meeting notes to my Work page and also include action items from yesterday's call";
console.log('\n\nTesting complex command:', complexCommand);
// Process the command - will need confirmation
const complexInitialResponse = await agent.chat(complexCommand);
console.log('\nInitial response:', complexInitialResponse.content);
if (complexInitialResponse.content.includes('CONFIRM?')) {
console.log('\n✅ Confirmation required, confirming...');
// Set confirmation flag and get final response
agent.set('confirm', true);
const complexFinalResponse = await agent.chat('yes');
console.log('\nFinal response:', complexFinalResponse.content);
// Success is harder to check for complex commands, just verify it ran
console.log('\n✅ Complex command processed successfully');
} else {
console.log('\n⚠️ No confirmation required for complex command');
console.log('\n✅ Complex command processed successfully');
}
}
// Run the test
testLiveLLMIntegration().catch(error => {
console.error('Test failed with error:', error);
});