Skip to main content

Overview

Google provides the Gemini family of multimodal models with strong capabilities in reasoning, vision, and grounding. Upsonic supports both the Gemini API and Vertex AI. Model Class: GoogleModel Provider Options:
  • google-gla: Gemini API (generativelanguage.googleapis.com)
  • google-vertex: Vertex AI API (requires GCP setup)

Authentication

export GOOGLE_API_KEY="AIza..."
# OR (legacy)
export GEMINI_API_KEY="AIza..."

# For Vertex AI
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="us-central1"  # Optional

Examples

from upsonic import Agent, Task
from upsonic.models.google import GoogleModel

model = GoogleModel(model_name="gemini-2.5-flash", provider="google-gla")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result.output)

Parameters

ParameterTypeDescriptionDefaultSource
max_tokensintMaximum tokens to generate2048Base
temperaturefloatSampling temperature (0.0-2.0)1.0Base
top_pfloatNucleus sampling threshold0.95Base
seedintRandom seed for deterministic outputsNoneBase
stop_sequenceslist[str]Sequences that stop generationNoneBase
presence_penaltyfloatPenalty for token presence0.0Base
frequency_penaltyfloatPenalty for token frequency0.0Base
google_safety_settingslist[SafetySettingDict]Content safety configurationNoneSpecific
google_thinking_configThinkingConfigDictThinking behavior configurationNoneSpecific
google_labelsdict[str, str]Billing labels (Vertex AI only)NoneSpecific
google_video_resolution'low' | 'medium' | 'high'Video processing resolutionNoneSpecific
google_cached_contentstrName of cached content to useNoneSpecific