You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to write "import { GoogleGenerativeAI } from "@google/generative-ai";" in your file and also you need to have
"imports": {
"@google/generative-ai": "npm:@google/generative-ai@^0.21.0",
},
in deno.json file
deno.json file is optional, you can just run directly a single file ts file,
import{GoogleGenerativeAI}from"npm:@google/generative-ai";importprocessfrom"node:process";asyncfunctionsearchGrounding(){// [USE google_search as a tool in Gemini 2.0]// Make sure to include these imports:// import {// GoogleGenerativeAI,// } from "@google/generative-ai";constgenAI=newGoogleGenerativeAI(process.env.GOOGLE_API_KEY??"");constmodel=genAI.getGenerativeModel({model: "gemini-2.0-flash-exp",tools: [{googleSearch: {},},],},);while(true){constinput=prompt(">");if(!input)break;constresult=awaitmodel.generateContent(input);console.log(result.response.text());console.log(result.response.candidates?.at(0)?.groundingMetadata);}// [END search_grounding]}awaitsearchGrounding();
Description of the bug:
I can't import this library in Deno:
Actual vs expected behavior:
Import should be valid
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: