Gists
Abstract
This report presents a method to optimize AI-generated scripts for processing costs using Gemini and Google Apps Script. By incorporating external knowledge from sources like StackOverflow, we demonstrate the effective generation of efficient scripts that minimize overhead while maintaining desired outcomes. This approach can be considered a dynamic pseudo-RAG technique.
Introduction
The proliferation of generative AI, exemplified by Google Gemini, has led to a surge in AI-generated scripts. This trend is evident in the growing number of questions on platforms like StackOverflow that involve AI-generated scripts. While this indicates a significant improvement in AI performance, it’s crucial to note that AI-generated scripts may not always be optimized for processing costs, especially when the prompt fails to provide sufficient context.
UtlApp was updated to v1.0.7.
You can see the detail information here https://github.com/tanaikech/UtlApp
Gists
Abstract
A script using resumable upload with file streams is proposed to enhance file handling within the Gemini Generative AI API for Node.js. This script allows uploading from web URLs and local storage, efficiently handles large files, and offers potential reusability with other Google APIs.
Description
The @google/generative-ai library provides a powerful way to interact with the Gemini Generative AI API using Node.js. This enables developers to programmatically generate creative text formats, translate languages, write different kinds of creative content, and answer your questions in an informative way, all powered by Gemini’s advanced AI models. Ref
Gists
Abstract
This study proposes a workaround to address the Gemini API’s current inability to directly process web content from URLs. By utilizing Google Apps Script, the method extracts relevant information from a specified URL and feeds it into the API for summarization. This approach offers a solution for generating comprehensive summaries from web-based content until the API’s limitations are resolved.
Introduction
While Gemini API offers powerful text generation capabilities, it currently faces limitations in directly accessing and processing web content from URLs. When prompted to summarize an article at a specific URL like Summarize the article at the following URL. https://###, the API often returns an error message indicating its inability to retrieve the necessary information. This limitation arises from the API’s current design, which may not be equipped to handle web requests and parse HTML content.
Gists
Abstract
Linking a Google Apps Script project to a GCP project enables you to export logs from the Class console to Logs Explorer for simplified analysis and debugging. By overcoming the limitations of in-script logging methods, this report outlines a method for exporting logs using the Cloud Logging API with Google Apps Script.
Introduction
While developing applications with Google Apps Script, the Class console is a valuable tool for debugging individual components. Ref However, a key limitation exists: by default, Google Apps Script projects on Google Drive are not linked to Google Cloud Platform (GCP) projects. In this unlinked scenario, logs from the Class console are only visible within the script editor, requiring manual copying for export.
Gists
Overview
This sample script demonstrates uploading multiple files using split asynchronous processes with resumable upload. It leverages JavaScript and HTML within Google Spreadsheets.
Description
In my previous report, “Resumable Upload of Multiple Files with Asynchronous Process for Google Drive”, I presented an approach for uploading files asynchronously.
This script builds upon that concept, introducing a method for uploading multiple files with split asynchronous processes that utilize resumable upload.
Here’s the process breakdown:
Gists

Abstract
This report proposes a novel learning method using Gemini to automate Q&A generation, addressing the challenges of manual Q&A creation. By integrating with Google tools, this approach aims to enhance learning efficiency, accessibility, and personalization while reducing costs.
Introduction
Mastering a new subject often demands a significant time commitment. A proven strategy for efficient learning is through question-and-answer (Q&A) practice. This method typically involves constructing a dataset of pertinent Q&A pairs and subsequently engaging in repeated practice until desired proficiency levels are achieved. While platforms such as Google Forms and Google Apps Script can streamline the Q&A creation and evaluation process, the manual generation of Q&A data remains a time-consuming and expensive endeavor. Minimizing the operational costs associated with scripting is crucial for long-term sustainability.
GeminiWithFiles was updated to v2.0.1
-
v2.0.1 (August 4, 2024)
- From this version,
codeExecution can be used. Ref
You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
UnlockSmartInvoiceManagementWithGeminiAPI was updated to v1.0.3.
-
v1.0.3 (August 3, 2024)
- On August 3, 2024, I upated GeminiWithFiles (https://github.com/tanaikech/GeminiWithFiles). In this version, PDF data can be processed with Gemini API without async/await. So, I updated UnlockSmartInvoiceManagementWithGeminiAPI.
You can see the detail information here https://github.com/tanaikech/UnlockSmartInvoiceManagementWithGeminiAPI
GeminiWithFiles was updated to v2.0.0
-
v2.0.0 (August 3, 2024)
- From this version, the following changes were made.
- PDF data can be directly used. Ref By this, PDFApp is not required to be used. By this, the script can be used without async/await.
- As the default,
functions: {} is used. So, the default function calling was removed. Because in the current stage, JSON output can be easily returned using a JSON schema and response_mime_type. Ref Ref
- The default model was changed from
models/gemini-1.5-pro-latest to models/gemini-1.5-flash-latest.
- The export values with
exportTotalTokens were changed. After v2.x.x, when this is true, the object usageMetadata including promptTokenCount, candidatesTokenCount, totalTokenCount is exported. At that time, the generated content and usageMetadata are returned as an object.
- After v2.x.x, the large files can be uploaded to Gemini. This is from this respository and this post.
You can see the detail information here https://github.com/tanaikech/GeminiWithFiles