A developer sample written in Go that demonstrates Gemini's creative writing abilities. With user input, Gemini writes a novella one section at a time.
This sample app can be opened in Project IDX, or run in your local dev environment.
-
Open this repo in Project IDX:
- Open in Project IDX
- Wait for the import process to complete
- Open the IDX Panel and click "Authenticate" with the Gemini API integration.
- Once authenticated, click to get a key which will be copied to your keyboard.
- Add the key to the env variable section in
.idx/dev.nix
.
-
Open a new terminal window:
- Open the command palette (CTRL/CMD-SHIFT-P)
- Begin typing terminal
- Select Terminal: Create New Terminal
- Run
go run .
-
Clone this repository:
git clone https://github.com/google-gemini/go-dreaming-of-adventure-sample
-
Verify that Go 1.22 or later is installed:
- Verify version with
go version
- In needed, install Go, see: https://go.dev/doc/install
- Verify version with
-
Get a Gemini API key
- Launch Google AI Studio: https://aistudio.google.com/
- Click Get API Key
-
Set the API Key in the
API_KEY
environment varaibleexport API_KEY=<your_api_key>
-
Compile and run the program:
go run .
-
When asked "What do you want to dream about?", answer with something fun.
- For example, type:
I want to dream about unicode
- For example, type: