63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
const { VertexAI } = require('@google-cloud/vertexai');
|
|
|
|
async function testGemini3Global() {
|
|
console.log('🧪 Testing Gemini 3 Pro Preview in GLOBAL location...\n');
|
|
|
|
const vertexAI = new VertexAI({
|
|
project: 'gen-lang-client-0980079410',
|
|
location: 'global', // ← KEY: Use 'global' not regional!
|
|
});
|
|
|
|
console.log('Model: gemini-3-pro-preview');
|
|
console.log('Location: global');
|
|
console.log('Project: gen-lang-client-0980079410\n');
|
|
|
|
try {
|
|
const model = vertexAI.getGenerativeModel({
|
|
model: 'gemini-3-pro-preview',
|
|
systemInstruction: 'You are a helpful AI assistant.',
|
|
generationConfig: {
|
|
temperature: 1.0,
|
|
responseMimeType: 'application/json',
|
|
},
|
|
});
|
|
|
|
console.log('⏳ Sending test request...\n');
|
|
|
|
const response = await model.generateContent({
|
|
contents: [{
|
|
role: 'user',
|
|
parts: [{
|
|
text: 'Return JSON with this exact structure: {"status": "success", "model": "gemini-3-pro-preview", "message": "Gemini 3 is working!", "features": ["thinking_mode", "1M_context", "multimodal"]}'
|
|
}],
|
|
}],
|
|
});
|
|
|
|
const text = response.response?.candidates?.[0]?.content?.parts?.[0]?.text || '';
|
|
console.log('✅ RAW RESPONSE:\n', text, '\n');
|
|
|
|
const parsed = JSON.parse(text);
|
|
|
|
if (parsed.status === 'success') {
|
|
console.log('🎉🎉🎉 SUCCESS! GEMINI 3 PRO PREVIEW IS WORKING! 🎉🎉🎉\n');
|
|
console.log('✅ Model:', parsed.model);
|
|
console.log('✅ Message:', parsed.message);
|
|
console.log('✅ Features:', parsed.features?.join(', '));
|
|
console.log('\n🚀 You have full access to Gemini 3 Pro Preview!');
|
|
console.log('📊 1M token context | Thinking mode | Multimodal');
|
|
return true;
|
|
}
|
|
} catch (error) {
|
|
console.error('❌ Error:', error.message);
|
|
if (error.message.includes('404')) {
|
|
console.log('\n💡 Model still not accessible. You may need to:');
|
|
console.log(' 1. Enable the model in the console');
|
|
console.log(' 2. Accept usage terms');
|
|
console.log(' 3. Wait for API access approval');
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
testGemini3Global();
|