New (gemini/gemini.go)

gortex · internal/llm/provider/gemini/gemini.go · go · Apache-2.0
ai

Package gemini is the hosted Google Gemini generateContent llm.Provider. It is pure Go — available in every build. Structured output uses Gemini's `responseSchema` + `responseMimeType: application/json` on the generationConfig: the model is constrained to emit JSON conforming to

// Source: https://github.com/zzet/gortex | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Package gemini is the hosted Google Gemini generateContent
// llm.Provider.
//
// It is pure Go — available in every build. Structured output uses
// Gemini's `responseSchema` + `responseMimeType: application/json` on
// the generationConfig: the model is constrained to emit JSON
// conforming to the requested JSONShape. The agent tool-loop uses the
// emulated protocol — tool calls and results travel as plain text
// turns — so a single llm.Message shape works across providers.
package gemini

import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/http"
	"os"
	"strings

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key