37 lines
1.2 KiB
Dart
37 lines
1.2 KiB
Dart
|
|
import 'package:google_generative_ai/google_generative_ai.dart';
|
||
|
|
import '../lib/secrets.dart';
|
||
|
|
|
||
|
|
void main() async {
|
||
|
|
final apiKey = Secrets.geminiApiKey;
|
||
|
|
|
||
|
|
final modelsToTest = [
|
||
|
|
'gemini-2.0-flash', // Should work based on listing
|
||
|
|
'gemini-2.5-flash', // Should fail? Or work if it was working before
|
||
|
|
'models/gemini-2.0-flash',
|
||
|
|
'gemini-1.5-flash', // Retesting
|
||
|
|
'gemini-1.5-pro',
|
||
|
|
'gemini-1.5-flash-8b',
|
||
|
|
];
|
||
|
|
|
||
|
|
print('Starting Expanded Model Verification...');
|
||
|
|
|
||
|
|
for (final modelName in modelsToTest) {
|
||
|
|
try {
|
||
|
|
print('\nTesting: $modelName');
|
||
|
|
final model = GenerativeModel(model: modelName, apiKey: apiKey);
|
||
|
|
final response = await model.generateContent([Content.text('Hello')]);
|
||
|
|
print('✅ SUCCESS: $modelName');
|
||
|
|
print('Response: ${response.text?.trim()}');
|
||
|
|
} catch (e) {
|
||
|
|
print('❌ FAILED: $modelName');
|
||
|
|
final msg = e.toString();
|
||
|
|
if (msg.contains('not found') || msg.contains('404')) {
|
||
|
|
print('Error: Model Not Found (404)');
|
||
|
|
} else {
|
||
|
|
// Print first 200 chars to debug other errors (like Quota)
|
||
|
|
print('Error: ${msg.substring(0, msg.length > 200 ? 200 : msg.length)}...');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|