gemini

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gemini provides a client for Google's Gemini AI API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnifiedPrompt

func UnifiedPrompt() string

UnifiedPrompt returns the streamlined prompt for timezone detection.

Types

type Cache added in v1.1.0

type Cache interface {
	APICall(key string, requestPayload []byte) ([]byte, bool)
	SetAPICall(key string, requestPayload []byte, responseData []byte) error
}

Cache defines the cache operations needed by the Gemini client.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Gemini API client.

func NewClient

func NewClient(apiKey, model, gcpProject string) *Client

NewClient creates a new Gemini API client.

func (*Client) CallWithSDK

func (c *Client) CallWithSDK(ctx context.Context, prompt string, cache Cache, logger Logger) (*Response, error)

CallWithSDK calls the Gemini API using the official SDK.

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Info(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
}

Logger defines the logging interface needed by the Gemini client.

type Response

type Response struct {
	// Place larger alignment fields first (float64 = 8 bytes)
	Latitude  float64 `json:"latitude"`  // GPS latitude coordinate
	Longitude float64 `json:"longitude"` // GPS longitude coordinate
	// Boolean field (1 byte, but usually padded)
	SuspiciousMismatch bool `json:"suspicious_mismatch"` // Flag for suspicious location patterns
	// Strings are pointers (8 bytes each on 64-bit), group them together
	DetectedTimezone   string `json:"detected_timezone"`
	DetectedLocation   string `json:"detected_location"`
	ConfidenceLevel    string `json:"confidence_level"` // "high", "medium", or "low"
	DetectionReasoning string `json:"detection_reasoning"`
	MismatchReason     string `json:"mismatch_reason"` // Explanation if suspicious_mismatch is true
}

Response represents the Gemini API response structure.

Jump to

Keyboard shortcuts

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