contaigents
Version:
Modular AI Content Ecosystem with Audio Generation
67 lines (63 loc) โข 3.17 kB
JavaScript
import { ChatService } from '../services/chatService.js';
/**
* Test Google provider with agentic behavior and tool calls
*/
class GoogleProviderAgenticTest {
constructor() {
// ChatService automatically initializes ToolManager with built-in tools
this.chatService = new ChatService(process.cwd());
}
async runTest() {
console.log('๐งช Testing Google Provider Agentic Behavior');
console.log('='.repeat(50));
try {
// Test 1: Simple conversation
console.log('\n๐ Test 1: Simple conversation');
const session1 = this.chatService.createSession({
systemPrompt: 'You are a helpful assistant. Respond concisely.'
});
const response1 = await this.chatService.sendMessage(session1.id, 'Hello! Can you tell me about your capabilities?', { provider: 'Google' });
console.log('โ
Simple conversation response:', response1.content.substring(0, 100) + '...');
// Test 2: Tool call detection and execution
console.log('\n๐ง Test 2: Tool call with file operations');
const session2 = this.chatService.createSession({
systemPrompt: 'You are a helpful assistant with file access tools. Use tools when needed.'
});
// Create a test file first
const testContent = `# Test File
This is a test file for Google provider agentic testing.
Created at: ${new Date().toISOString()}
## Features
- Tool call detection
- File operations
- Agentic behavior
`;
const response2 = await this.chatService.sendMessage(session2.id, `Please create a file called "google-test.md" with the following content:
${testContent}
Then read it back to confirm it was created successfully.`, { provider: 'Google' });
console.log('โ
Tool call response received');
console.log('Response length:', response2.content.length);
console.log('Response preview:', response2.content.substring(0, 200) + '...');
// Test 3: Multi-turn conversation with context
console.log('\n๐ฌ Test 3: Multi-turn conversation');
const response3 = await this.chatService.sendMessage(session2.id, 'What was in the file you just created?', { provider: 'Google' });
console.log('โ
Multi-turn response:', response3.content.substring(0, 150) + '...');
console.log('\n๐ All Google provider agentic tests completed successfully!');
}
catch (error) {
console.error('โ Test failed:', error);
if (error instanceof Error) {
console.error('Error details:', error.message);
if (error.message.includes('not configured')) {
console.log('\n๐ก Tip: Make sure to configure Google provider first:');
console.log(' contaigents configure');
console.log(' Then select Google and provide your API key');
}
}
}
}
}
// Run the test
const test = new GoogleProviderAgenticTest();
test.runTest().catch(console.error);