blob: e06c87286313e667cbeec99cc1283fec5433dc6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package main
import (
"context"
"flag"
"fmt"
"log"
"github.com/google/generative-ai-go/genai"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"within.website/x/internal"
)
var (
geminiApiKey = flag.String("gemini-api-key", "", "The Gemini API key")
geminiModel = flag.String("gemini-model", "gemini-1.5-flash", "The model to use for generating text")
)
func main() {
internal.HandleStartup()
ctx := context.Background()
client, err := genai.NewClient(ctx, option.WithAPIKey(*geminiApiKey))
if err != nil {
log.Fatal(err)
}
defer client.Close()
iter := client.ListModels(ctx)
for {
m, err := iter.Next()
if err == iterator.Done {
break
}
if err != nil {
panic(err)
}
fmt.Println(m.Name, m.Description)
}
}
|