Skip to content

Instantly share code, notes, and snippets.

View tanaikech's full-sized avatar

Kanshi TANAIKE tanaikech

View GitHub Profile
@tanaikech
tanaikech / submit.md
Created May 21, 2024 06:59
Taming the Wild Output: Effective Control of Gemini API Response Formats with response_schema

Taming the Wild Output: Effective Control of Gemini API Response Formats with response_schema

Abstract

The Gemini API traditionally required specific prompts for desired output formats. This report explores two new GenerationConfig properties: "response_mime_type" and "response_schema". These allow developers to directly specify formats like JSON, enhancing control and predictability. We analyze and compare the effectiveness of both properties for controlling Gemini API output formats.

Introduction

@tanaikech
tanaikech / submit.md
Created May 16, 2024 02:03
Checking API Enabled with Advanced Google Services using Google Apps Script

Checking API Enabled with Advanced Google Services using Google Apps Script

Overview

This script checks if the desired API is enabled or disabled in the Advanced Google Services section of Google Apps Script.

Introduction

@tanaikech
tanaikech / submit.md
Created May 15, 2024 00:20
Adding Page Numbers to PDF using Google Apps Script

Adding Page Numbers to PDF using Google Apps Script

Description

This is a simple sample script for adding the page numbers to PDF data using Google Apps Script.

When you use this script, please copy and paste the following script to the script editor of Google Apps Script. And, please set the file ID of the PDF file.

@tanaikech
tanaikech / submit.md
Created May 8, 2024 05:27
Leveraging Gemini 1.5 API for Automated Test Case Generation in Google Apps Script Reverse Engineering

Leveraging Gemini 1.5 API for Automated Test Case Generation in Google Apps Script Reverse Engineering

Abstract

This report examines leveraging Gemini 1.5 API with Google Apps Script to automate sample input creation during script reverse engineering. Traditionally, this process is manual and time-consuming, especially for functions with numerous test cases. Gemini 1.5 API's potential to streamline development by automating input generation is explored through applying reverse engineering techniques to Google Apps Script samples.

Introduction

@tanaikech
tanaikech / submit.md
Last active May 7, 2024 09:45
Gemini API with JSON schema

Gemini API with JSON schema

Overview

These are sample scripts in Python and Node.js for controlling the output format of the Gemini API using JSON schemas.

Description

In a previous report, "Taming the Wild Output: Effective Control of Gemini API Response Formats with response_mime_type," I presented sample scripts created with Google Apps Script. Ref Following its publication, I received requests for sample scripts using Python and Node.js. This report addresses those requests by providing sample scripts in both languages.

@tanaikech
tanaikech / submit.md
Last active May 3, 2024 08:08
Inserting Animated GIFs over Cells on Google Sheets using Google Apps Script

Inserting Animated GIFs over Cells on Google Sheets using Google Apps Script

Overview

This script demonstrates how to insert an animated GIF over cells in a Google Sheet using Google Apps Script.

Description

I recently received a request to create a Google Apps Script for inserting animated GIFs into cells on a Google Sheet. I previously published a sample script on my blog on June 6, 2017. Ref In that script, the animation GIF was inserted using a public link. This new script leverages data URLs, which simplifies the process for using GIFs stored in Google Drive. Since this approach might be helpful to others, I'm sharing it here.

@tanaikech
tanaikech / submit.md
Last active May 1, 2024 05:03
Taming the Wild Output: Effective Control of Gemini API Response Formats with response_mime_type

Taming the Wild Output: Effective Control of Gemini API Response Formats with response_mime_type

Abstract

This report explores controlling output formats for the Gemini API. Traditionally, prompts dictated the format. A new property, "response_mime_type", allows specifying the format (e.g., JSON) directly. Testing confirms this property improves control over output format, especially for complex JSON schemas. The recommended approach is to combine a detailed JSON schema with "response_mime_type" for clear and consistent outputs.

Introduction

@tanaikech
tanaikech / submit.md
Created April 26, 2024 06:19
Batch Processing Powerhouse: Leverage Gemini 1.5 API and Google Apps Script for Efficient Content Workflows

Batch Processing Powerhouse: Leverage Gemini 1.5 API and Google Apps Script for Efficient Content Workflows

Abstract

A new Google Apps Script library, "GeminiWithFiles", simplifies using the powerful Gemini 1.5 AI model. It lets users directly upload files for content generation or create descriptions for many images at once, making it much faster than prior methods. This is helpful for tasks involving large amounts of text or images.

Introduction

@tanaikech
tanaikech / submit.md
Last active April 16, 2024 13:00
Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Abstract

Consolidate scattered cell references (A1Notation) in Google Sheets for efficiency. This script helps select cells by background color or update values/formats, overcoming limitations of large range lists.

Introduction

@tanaikech
tanaikech / submit.md
Created April 10, 2024 05:39
Specifying Output Types for Gemini API with Google Apps Script

Specifying Output Types for Gemini API with Google Apps Script

Abstract

The Gemini API generates different outputs depending on the prompts. This report explains how to use function calling in the new Gemini 1.5 API to control the output format (string, number, etc.) within a script during a chat session. This allows for more flexibility in using the Gemini API's results.

Introduction