Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 2.23 KB

File metadata and controls

55 lines (44 loc) · 2.23 KB

Angular language learning sample

Developer sample written in Angular, demonstrating how to use system instruction and prompting in the Gemini API to collaboratively and iteratively create to create quiz questions in supported languages

Open in IDX

Setup & Getting Started

This example uses Angular and Gemini API.

Before you start

Your system needs to be configured to run Angular.

You need Gemini API key in order to run this demo. Here's how:

  1. Launch Google AI Studio
  2. Click "Get API Key"

Caution: Using the Google AI SDK for JavaScript directly from a client-side app is recommended for prototyping only. For non-prototyping use cases, we strongly recommend that you call the Google AI Gemini API only server-side to keep your API key safe. If you embed your API key directly in your JavaScript app or fetch it remotely at runtime, you risk potentially exposing your API key to malicious actors.

Getting the code

You have two options to get this code:

Configure your environment

To run this application, you can either

  • hard code your API key in server.ts
  • set it as an environment variable called API_KEY

Starting the application

Note: Do not use ng serve as this sample uses server side rendering (SSR).

  1. Build the example with ng build
  2. Run the demo with npm start
  3. Navigate to http://localhost:4000/

That's it, have fun!

Making local changes

Note: Do not use ng serve as this sample uses server side rendering (SSR).

  1. Update the files.
  2. Stop the server
  3. Run ng build
  4. Run npm start