๐Ÿ“ฆ fredsa / hello-gemini-api

โ˜… 0 stars โ‘‚ 0 forks ๐Ÿ‘ 0 watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/fredsa/hello-gemini-api.git
HTTPS git clone https://github.com/fredsa/hello-gemini-api.git
SSH git clone git@github.com:fredsa/hello-gemini-api.git
CLI gh repo clone fredsa/hello-gemini-api
Fred Sauer Fred Sauer Hello, Gemini API. 958cd62 1 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“„ go.mod
๐Ÿ“„ go.sum
๐Ÿ“„ LICENSE
๐Ÿ“„ main.go
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Hello, Gemini API.

Sample app showing how to access Gemini using the Gemini API.

Prerequisites

  • Download and install Go, see https://go.dev/. To determine the version of Go
that is available on your path run:

go version

  • [Optional] Install gcloud CLI, see https://cloud.google.com/sdk/docs/install.

Prepare sample project

  • Clone this repo.
git clone git@github.com:fredsa/hello-gemini-api.git

  • Change into the project directory.
cd hello-gemini-api

  • Install the
github.com/google/generative-ai-go/genai package.

go get github.com/google/generative-ai-go/genai

Authorize the app

  • Modify main.go to use this API key.
const apiKey = "your-api-key"  // Keep safe.

  • Keep your API key safe.

Run the sample

  • Compile and run.
go run main.go

The output should look something like this

>> Hello, who are you?
    I am a large language model, trained by Google.