2025-01-05 14:16:31 -07:00
import { DeepSeekService } from '../lib/services/deepseekService' ;
2025-01-06 21:25:15 -07:00
import dotenv from 'dotenv' ;
2025-01-05 14:16:31 -07:00
2025-01-06 21:25:15 -07:00
dotenv . config ( ) ;
async function testDeepseekService() {
const service = new DeepSeekService ( ) ;
2025-01-05 14:16:31 -07:00
try {
2025-01-06 21:25:15 -07:00
console . log ( 'Starting DeepSeek test...' ) ;
console . log ( 'Base URL:' , process . env . OLLAMA_URL || 'http://localhost:11434' ) ;
2025-01-05 14:16:31 -07:00
2025-01-06 21:25:15 -07:00
const testQuery = {
role : "user" ,
content : "Find plumbers in Denver, CO. You must return exactly 10 results in valid JSON format, sorted by rating from highest to lowest. Each result must include a rating between 1-5 stars. Do not include any comments or explanations in the JSON."
} ;
2025-01-05 14:16:31 -07:00
2025-01-06 21:25:15 -07:00
console . log ( 'Sending test query:' , testQuery ) ;
const response = await service . chat ( [ testQuery ] ) ;
2025-01-05 14:16:31 -07:00
2025-01-06 21:25:15 -07:00
console . log ( '\nTest successful!' ) ;
console . log ( 'Parsed response:' , JSON . stringify ( response , null , 2 ) ) ;
2025-01-05 14:16:31 -07:00
2025-01-06 21:25:15 -07:00
} catch ( error ) {
console . error ( '\nTest failed!' ) ;
if ( error instanceof Error ) {
console . error ( 'Error message:' , error . message ) ;
console . error ( 'Stack trace:' , error . stack ) ;
2025-01-05 14:16:31 -07:00
} else {
2025-01-06 21:25:15 -07:00
console . error ( 'Unknown error:' , error ) ;
2025-01-05 14:16:31 -07:00
}
}
}
2025-01-06 21:25:15 -07:00
// Run the test
console . log ( '=== Starting DeepSeek Service Test ===\n' ) ;
testDeepseekService ( ) . then ( ( ) = > {
console . log ( '\n=== Test Complete ===' ) ;
} ) . catch ( error = > {
console . error ( '\n=== Test Failed ===' ) ;
console . error ( error ) ;
} ) ;