Friday Gemini AI

Gem Version CI Security Release

Ruby gem for Google's Gemini AI models.

Installation

gem install friday_gemini_ai

Create a .env file and add your API key:

GEMINI_API_KEY=your_api_key_here

Usage

require_relative 'lib/gemini'

GeminiAI.load_env

# Use the latest Gemini 2.5 Pro (default)
client = GeminiAI::Client.new
response = client.generate_text('Write a haiku about Ruby')
puts response

# Or choose a specific model
flash_client = GeminiAI::Client.new(model: :flash)  # Gemini 2.5 Flash
pro_client = GeminiAI::Client.new(model: :pro)      # Gemini 2.5 Pro
./bin/gemini test
./bin/gemini generate "Your prompt here"
./bin/gemini chat

Supported Models

Model Key Model ID Description
:pro gemini-2.5-pro Latest and most capable model
:flash gemini-2.5-flash Fast and efficient latest model
:flash_2_0 gemini-2.0-flash Previous generation fast model
:flash_lite gemini-2.0-flash-lite Lightweight model
:pro_1_5 gemini-1.5-pro Gemini 1.5 Pro model
:flash_1_5 gemini-1.5-flash Gemini 1.5 Flash model
:flash_8b gemini-1.5-flash-8b Compact 8B parameter model

Model Selection Guide:

  • Use :pro for complex reasoning and analysis
  • Use :flash for fast, general-purpose tasks
  • Use :flash_2_0 for compatibility with older workflows
  • Use :flash_lite for simple, lightweight tasks

What You Can Do

Text Generation

  • Generate creative content, stories, and articles
  • Create explanations and educational content
  • Write code comments and documentation

Conversational AI

  • Build multi-turn chat applications
  • Create interactive Q&A systems
  • Develop conversational interfaces

Image Analysis

  • Analyze images with text prompts
  • Extract information from visual content
  • Generate descriptions of images

Quick Tasks

  • Test ideas and prompts via CLI
  • Prototype AI-powered features
  • Generate content with custom parameters

Features

  • Text generation and chat conversations
  • Support for Gemini 2.5, 2.0, and 1.5 model families
  • Configurable parameters (temperature, tokens, top-p, top-k)
  • Error handling and API key security
  • CLI interface and .env integration

Documentation

Getting Started

Reference

Guides

Examples

  • examples/basic.rb - Text generation and chat
  • examples/advanced.rb - Configuration and error handling

Testing

ruby tests/runner.rb
ruby tests/unit/client.rb
ruby tests/integration/api.rb

Contributing

Fork, branch, commit, push, pull request.

License

MIT - see LICENSE