Chat

<html>
<body>
  <!-- ... Your HTML and CSS -->
  <!-- Import @google/generative-ai, as shown above. -->
  <script type="module">
      import { GoogleGenerativeAI } from "@google/generative-ai";

      // Fetch your API_KEY
      const API_KEY = "...";

      // Access your API key (see "Set up your API key" above)
      const genAI = new GoogleGenerativeAI(AIzaSyD6_XJT5vQXEgbciWDtpuD86iZ24kW2Bpk);

     async function run() {
  // For text-only input, use the gemini-pro model
  const model = genAI.getGenerativeModel({ model: "gemini-pro"});

  const prompt = "Write a story about a magic backpack."

  const result = await model.generateContent(prompt);
  const response = await result.response;
  const text = response.text();
  console.log(text);
}

run();

      // ...
  </script>
</body>
</html>
Scroll to Top