In this module we draw on the knowledge we gained from previous lessons and harness the power of custom server connect modules to create a Google Gemini AI extension by interfacing with the "@google/generative-ai" npm module (23 mins)
** PLEASE NOTE**
- Should have checked the sample code better.
Please amend
result = run(prompt);
We need to await the promise which does not appear in the sample code from google which i did not notice and also forgot to declare the variable properly so amend line 16 to:
const result = await run(prompt);
The data scheme defined in the HJSON is not used so should be removed or this will lead to confusion as the picker will show incorrect elements. Alternatively return the reply using the schema by amending
return result
with
return { "result": result }
files:
gemini.zip (1.2 KB)
NPM updated (v1.0.2) to include promise fix and now returns scheme based output