Skip to main content

A simple module for making AI requests to Gemini API

Project description

Easy AI Module

A simple Python package for personal use that makes it easy to interact with Google's Gemini AI API.

Installation

pip install -e .

Usage

First, replace the API_KEY in easy_ai_module/gemini_client.py with your actual Gemini API key.

Text Generation

from easy_ai_module import GeminiAI

ai = GeminiAI()  # Defaults to gemini-2.0-flash

# Generate text from a prompt
response = ai.generate_text("Write a short story about a robot")
print(response)

# Customize parameters
response = ai.generate_text(
    prompt="Write a haiku about the moon",
    max_tokens=100,
    temperature=0.3  # Lower temperature for more focused output
)
print(response)

Image Analysis

from easy_ai_module import GeminiAI

ai = GeminiAI()

# Analyze an image (requires valid image URL)
image_url = "https://example.com/image.jpg"
response = ai.generate_with_image("What's in this image?", image_url)
print(response)

Models

You can specify different Gemini models:

# Use Gemini 1.5 Flash
ai = GeminiAI(model="gemini-1.5-flash")

# Use Gemma 3
ai = GeminiAI(model="gemma-3")

# Use Gemini 2.0 Flash (default)
ai = GeminiAI(model="gemini-2.0-flash")

# Use Gemini 2.0 Flash-Lite
ai = GeminiAI(model="gemini-2.0-flash-lite")

Model Selection Guide

The package includes a helpful guide to select the right model for your needs:

# Show general help on model selection
from easy_ai_module import GeminiAI
GeminiAI.help()

# Get recommendation for a specific use case
GeminiAI.help('reasoning')  # For complex reasoning tasks
GeminiAI.help('speed')      # For fastest response times
GeminiAI.help('budget')     # For cost-effective usage
GeminiAI.help('creative')   # For creative content generation
GeminiAI.help('image')      # For image analysis tasks
GeminiAI.help('local')      # For models that can run locally

Detailed Model Information

For detailed information about model capabilities, strengths, and pricing:

from easy_ai_module import print_model_guide

# Show information about all models
print_model_guide()

# Show information about a specific model
print_model_guide('gemini-2.0-flash')

Testing Tools

The package includes tools for testing and benchmarking models:

# Run a simple test with the default model
python model_demo.py

# Show the detailed guide for all models
python model_demo.py --guide

# Show help for a specific use case
python model_demo.py --show-help --use-case creative

# Run benchmarks on all models
python model_demo.py --benchmark

# Test a specific model with a custom prompt
python model_demo.py --model gemini-2.0-flash-lite --prompt "Explain quantum computing"

# Run all tests (help menu, benchmarks, and model guide)
python model_demo.py --test-all --verbose

Note

This package is for personal use only and contains a hardcoded API key. Do not share it with others.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_ai_module-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_ai_module-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file easy_ai_module-0.1.0.tar.gz.

File metadata

  • Download URL: easy_ai_module-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for easy_ai_module-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78ce49d572f88a267b3fd4a5a34773d698d055a7f2259f2ae089c320d45f11a5
MD5 43e2d69acbe8cf2c5fac2efd612defeb
BLAKE2b-256 dd7da15ce77582bcdd49382a03ae03b3f66cd543382bfd2408fbb25c7ad1378a

See more details on using hashes here.

File details

Details for the file easy_ai_module-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: easy_ai_module-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for easy_ai_module-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73ce1778426fd2070e937605711d5c357a4bbc84d928865de8dd8f013a50fb7a
MD5 0b2e0ef1ce31f208f9661fa9e9903f2b
BLAKE2b-256 30d2028d304f738b681068d995d59ef4d0cb7e331e156d91bf8d2d6373b11ef9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page