| David Crawshaw | 3b4d2b8 | 2025-05-04 10:48:25 -0700 | [diff] [blame] | 1 | package gemini |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "os" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | func TestGenerateContent(t *testing.T) { |
| 10 | // TODO replace with local replay endpoint |
| 11 | m := Model{ |
| 12 | Model: "models/gemini-1.5-flash", |
| 13 | APIKey: os.Getenv("GEMINI_API_KEY"), |
| 14 | } |
| 15 | if testing.Short() { |
| 16 | t.Skip("skipping test in short mode") |
| 17 | } |
| 18 | if m.APIKey == "" { |
| 19 | t.Skip("skipping test without API key") |
| 20 | } |
| 21 | |
| 22 | res, err := m.GenerateContent(context.Background(), &Request{ |
| 23 | Contents: []Content{{ |
| 24 | Parts: []Part{{ |
| 25 | Text: "What is the capital of France?", |
| 26 | }}, |
| 27 | }}, |
| 28 | }) |
| 29 | if err != nil { |
| 30 | t.Fatal(err) |
| 31 | } |
| 32 | t.Logf("res: %+v", res) |
| 33 | } |