|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
| 15 | +// [START aiplatform_gemini_get_started] |
15 | 16 | const {VertexAI} = require('@google-cloud/vertexai');
|
16 | 17 |
|
| 18 | +/** |
| 19 | + * TODO(developer): Update these variables before running the sample. |
| 20 | + */ |
17 | 21 | async function createStreamMultipartContent(
|
18 | 22 | projectId = 'PROJECT_ID',
|
19 |
| - location = 'LOCATION_ID', |
20 |
| - model = 'MODEL', |
| 23 | + location = 'us-central1', |
| 24 | + model = 'gemini-pro-vision', |
21 | 25 | image = 'gs://generativeai-downloads/images/scones.jpg',
|
22 | 26 | mimeType = 'image/jpeg'
|
23 | 27 | ) {
|
24 |
| - // [START aiplatform_gemini_get_started] |
25 |
| - |
26 |
| - /** |
27 |
| - * TODO(developer): Uncomment these variables before running the sample. |
28 |
| - */ |
29 |
| - // const projectId = 'your-project-id'; |
30 |
| - // const location = 'us-central1'; |
31 |
| - // const model = 'chosen-genai-model'; |
32 |
| - // const image = 'gs://generativeai-downloads/images/scones.jpg'; // Google Cloud Storage image |
33 |
| - // const mimeType = 'image/jpeg'; |
34 |
| - |
35 | 28 | // Initialize Vertex with your Cloud project and location
|
36 | 29 | const vertexAI = new VertexAI({project: projectId, location: location});
|
37 | 30 |
|
@@ -68,9 +61,8 @@ async function createStreamMultipartContent(
|
68 | 61 | for await (const item of responseStream.stream) {
|
69 | 62 | process.stdout.write(item.candidates[0].content.parts[0].text);
|
70 | 63 | }
|
71 |
| - |
72 |
| - // [END aiplatform_gemini_get_started] |
73 | 64 | }
|
| 65 | +// [END aiplatform_gemini_get_started] |
74 | 66 |
|
75 | 67 | createStreamMultipartContent(...process.argv.slice(2)).catch(err => {
|
76 | 68 | console.error(err.message);
|
|
0 commit comments