example

command
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Command example shows the public API of the core/llm/gemini package: build a reusable Client, bind a structured-output type with New, and call Generate to get a fully decoded value plus token usage and finish reason.

It needs a real Gemini key, so it reads two env vars and is a no-op without them. Run it from the core module with:

export GEMINI_API_KEY=...           # your key
export GEMINI_MODEL=gemini-3        # any model id (never hard-coded)
go run ./llm/gemini/example

Cloud-credential recipe (#854 auth matrix — Gemini on Vertex AI):

hc, _ := llmauth.NewGoogleDefaultHTTPClient(ctx)            // ADC; or NewGoogleServiceAccountHTTPClient
c := gemini.NewClient("", model,                            // empty key: transport owns auth
	gemini.WithVertexAI(project, location),
	gemini.WithHTTPClient(hc))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL