Gemini

Uploading Large Files to Gemini with Google Apps Script: Overcoming 50 MB Limit

Gists Abstract Uploads in Google Apps Script are limited to 50 MB, hindering work with large datasets. This report introduces a script with uploadType=resumable to overcome this limit, enabling uploads over 50 MB to Gemini and other services. Introduction This report explores the limitations of data upload size using Google Apps Script and introduces a script to overcome these limitations. In the current stage, Gemini API can generate content using the uploaded data to Gemini.

Updated: GAS Library - GeminiWithFiles

GeminiWithFiles was updated to v1.0.7. v1.0.7 (July 4, 2024) From this version, when doCountToken: true and exportTotalTokens: true are used in the object of the argument of geminiWithFiles, the total tokens are returned. In this case, the returned value is an object like {returnValue: "###", totalTokens: ###}. Ref You can see the detail information here https://github.com/tanaikech/GeminiWithFiles

Updated: GAS Application - UnlockSmartInvoiceManagementWithGeminiAPI

UnlockSmartInvoiceManagementWithGeminiAPI was updated to v1.0.1. v1.0.1 (June 17, 2024) In order to easily customize the value of “jsonSchema” for generating content with Gemini API, I added it as a new sheet of “jsonSchema” sheet in the Spreadsheet. When you customize it, you can edit the cell “A1” of the “jsonSchema” sheet. By this, the script generates content with Gemini API using your customized JSON schema. The cell “A2” is the number of characters of “A1”.

Unlock Smart Invoice Management: Gemini, Gmail, and Google Apps Script Integration

Gists You can see the presentation of this application at https://www.youtube.com/watch?v=Dc2WPQkovZE. Abstract This report describes an invoice processing application built with Google Apps Script. It leverages Gemini, a large language model, to automatically parse invoices received as email attachments and automates the process using time-driven triggers. Introduction The emergence of large language models (LLMs) like ChatGPT and Gemini has significantly impacted various aspects of our daily lives. One such example

Updated: GAS Library - GeminiWithFiles

GeminiWithFiles was updated to v1.0.5. v1.0.5 (June 7, 2024) Spelling mistakes in the warning message were modified. The wait time for changing the value of state for the movie file is changed from 5 seconds to 10 seconds per cycle. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles

Expanding Error Messages for Google Apps Script with Gemini 1.5 Flash

Gitst Abstract This report builds on prior work using Gemini 1.0 Pro to expand Google Apps Script error messages. It highlights how the script’s execution time limit created a bottleneck, but the introduction of Gemini 1.5 Flash eliminates this issue. Introduction After the release of the Gemini API, I previously reported on “Expanding Error Messages of Google Apps Script using Gemini Pro API with Google Apps Script”. Ref In that report, I utilized the Gemini 1.

Updated: GAS Library - GeminiWithFiles

GeminiWithFiles was updated to v1.0.4. v1.0.4 (May 29, 2024) Recently, when model.countToken is used with the uploaded files, I confirmed that an error like You do not have permission to access the File ### or it may not exist. occurred. In order to handle this issue, I modified the library. In order to use the movie files for generateContent, I modified the library. Ref You can see the detail information here https://github.

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

Gists 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 One of the key challenges when working with the Gemini API is ensuring the output data is delivered in the format your application requires.

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

Gists 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 With the release of Gemini 1.5 API, users gained the ability to process more complex data, opening doors for various application developments.

Gemini API with JSON schema

Gists 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.

Updated: GAS Library - GeminiWithFiles

GeminiWithFiles was updated to v1.0.2. v1.0.2 (May 7, 2024) For generating content, parts was added. From this version, you can select one of q, jsonSchema, and parts. From this version, systemInstruction can be used. In order to call the function call, toolConfig was added to the request body. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles

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

Gists 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 One of the key challenges when working with the Gemini API is ensuring the output data is in the format your application requires.

GAS Library - GeminiWithFiles

Overview This is a Google Apps Script library for Gemini API with files. A new Google Apps Script library called GeminiWithFiles simplifies using Gemini, a large language model, to process unstructured data like images and PDFs. GeminiWithFiles can upload files, generate content, and create descriptions from multiple images at once. This significantly reduces workload and expands possibilities for using Gemini. Description Recently, Gemini, a large language model from Google AI, has brought new possibilities to various tasks by enabling the use of unstructured data as structured data.

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

Gists 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 Recently, Gemini, a family of Google’s most capable AI models, has revolutionized various tasks by allowing unstructured data to be used as structured data.

Specifying Output Types for Gemini API with Google Apps Script

Gists 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 The appearance of Gemini has already brought a wave of innovation to various fields. When the Gemini API returns a response, the format of the response is highly dependent on the input text provided as a prompt.

Parsing Invoices using Gemini 1.5 API with Google Apps Script

Gists Abstract This report explores using Gemini, a new AI model, to parse invoices in Gmail attachments. Traditional text searching proved unreliable due to invoice format variations. Gemini’s capabilities can potentially overcome this inconsistency and improve invoice data extraction. Introduction After Gemini, a large language model from Google AI, has been released, it has the potential to be used for modifying various situations, including information extraction from documents. In my specific case, I work with invoices in PDF format.

Analyzing Trends of Google Apps Script from Questions on Stackoverflow using Gemini 1.5 API

Gists Abstract A new large language model (LLM) called Gemini with an API is now available, allowing developers to analyze vast amounts of data. This report explores trends in Google Apps Script by using the Gemini 1.5 API to analyze questions on Stack Overflow. Introduction The release of the LLM model Gemini as an API on Vertex AI and Google AI Studio has opened a world of possibilities. Ref The Gemini API significantly expands the potential of various scripting languages, paving the way for diverse applications.

Generating Texts using Files Uploaded by Gemini 1.5 API

Gists Abstract The Gemini API allows the generating of text from uploaded files using Google Apps Script. It expands the potential of various scripting languages for diverse applications. Introduction With the release of the LLM model Gemini as an API on Vertex AI and Google AI Studio, a world of possibilities has opened up. Ref The Gemini API significantly expands the potential of various scripting languages and paves the way for diverse applications.

Crafting Bespoke Output Formats with Gemini API

Gists Abstract The Gemini API unlocks potential for diverse applications but requires consistent output formatting. This report proposes a method using question phrasing and API calls to craft a bespoke output, enabling seamless integration with user applications. Examples include data categorization and obtaining multiple response options. Introduction With the release of the LLM model Gemini as an API on Vertex AI and Google AI Studio, a world of possibilities has opened up.

Attempting Reverse Engineering with Gemini API and Google Apps Script

Gists Abstract Gemini API on Vertex AI/Studio unlocks new applications with data retrieval and content generation through function calls. This report explores using the API for reverse engineering with a sample interpreter in Google Apps Script. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio unlocks a vast potential for new applications and methodologies. It significantly expands capabilities across diverse situations, paving the way for groundbreaking applications.

Enhanced Search using Gemini API

Gists Abstract The Gemini API can now do semantic searches, going beyond content generation. This means it can understand the meaning of your search and provide better results, even if your words don’t exactly match the data. This report introduces the enhanced search capabilities of the Gemini API. Introduction The Gemini API expands its potential beyond content generation to encompass powerful semantic search capabilities. Searching existing data is crucial in various situations.

Similarity Viewer using Gemini API with Google Spreadsheet and Google Apps Script

Gists Abstract The Gemini API enables both content generation and semantic search, managing data effectively. This report introduces a Gemini-powered similarity viewer for easy visualization of complex text similarity scores, using Google Spreadsheet and Apps Script. Introduction The Gemini API unlocks new possibilities, extending its capabilities beyond content generation to encompass semantic search. Within this context, the API excels at efficiently managing data within corpora. While semantic search provides valuable similarity scores (chunkRelevanceScore) for text pairs, interpreting these numerical values can be cumbersome.

Updated: GAS Library - CorporaApp

CorporaApp was updated to v1.0.2. v1.0.2 (February 26, 2024) New method of setAccessToken was added. When this method is used, you can use the access token retrieved from the service account. Default access token is retrieved by ScriptApp.getOAuthToken(). You can see the detail information here https://github.com/tanaikech/CorporaApp

Creating Image Bot using Gemini with Google Apps Script

Gists Abstract New Gemini API opens doors for developers to integrate its AI power into apps, potentially impacting education, healthcare, and business. The latest Gemini 1.5 brings even more features. This report showcases an image bot using Gemini as one example of its diverse applications. Showcasing its diverse application potential across various fields. Introduction The recent release of Gemini as an accessible API on Vertex AI and Google AI Studio empowers developers to integrate its vast capabilities into their applications, potentially revolutionizing fields like education, healthcare, and business.

Guide to Function Calling with Gemini and Google Apps Script

Gists Abstract Powerful AI tool Gemini’s API release (Vertex AI & Google AI Studio) opens doors for diverse applications. Its recent upgrade to version 1.5 boosts capabilities. This report demonstrates using simple Google Apps Script function calls to leverage Gemini’s power for both data retrieval and content generation. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio unlocks a world of possibilities.

Applying Gemini Pro API to Flexible Templates using Google Apps Script

Gists Abstract New “semantic search” features in Gemini API help find desired information within its corpora. While using these features with Google Apps Script was complex, a new library simplifies the process. This report proposes using this library with Gemini-generated content to automate template processes in Google Docs and Slides, creating a more flexible workflow. Introduction The semantic search opens up a new wind for finding the expected values. Recently, the APIs for managing corpora have been added to Gemini API.

Semantic Search using Corpus of Gemini API with Google Apps Script

Gists Description In the current stage, v1beta of Gemini API can use the corpora. Ref When the corpora are used, the values can be searched with the semantic search. In the current stage, 5 corpora can be created in a single project. And, each corpus can have 10,000 documents and 1,000,000 chunks. In this report, I would like to introduce a method for achieving the semantic search using the corpora with Google Apps Script.

Flexible Labeling for Gmail using Gemini Pro API with Google Apps Script Part 2

Gists Description I have published “Flexible Labeling for Gmail using Gemini Pro API with Google Apps Script” on December 19, 2023. Today, I published “Categorization using Gemini Pro API with Google Apps Script”. In this report, as part 2, I would like to introduce 2 sample scripts for flexible labeling for Gmail using the semantic search and the function calling of Gemini Pro API with Google Apps Script. Usage In order to test this script, please do the following flow.

Categorization using Gemini Pro API with Google Apps Script

Gists Abstract This report explores using the Gemini Pro API with Google Apps Script to achieve flexible data categorization. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio opens a world of possibilities. Ref and Ref I believe Gemini API significantly expands the potential of Google Apps Script and paves the way for diverse applications. In this report, I present the flexible categorization of data using Gemini Pro API with Google Apps Script.

Semantic Search using Gemini Pro API with Google Apps Script

Gists Abstract Gemini API unlocks semantic search for Google Apps Script, boosting its power beyond automation. This report explores the result of attempting the semantic search using Gemini Pro API with Google Apps Script. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio opens a world of possibilities. Ref and Ref I believe Gemini API significantly expands the potential of Google Apps Script and paves the way for diverse applications.

Inserting Generated Text to Google Documents, Google Spreadsheets, and Google Slides using Gemini Pro API with Google Apps Script

Gists Description When the generated text can be automatically inserted into the cursor position of Google Document, Google Spreadsheet, and Google Slide, it will be useful for users. This report introduces sample scripts for achieving this. Sample scripts Here, I would like to introduce 3 sample scripts for a Google Document, a Google Spreadsheet, and a Google Slide. Create an API key These sample scripts request Gemini Pro API using an API key.

Expanding Error Messages of Google Apps Script using Gemini Pro API with Google Apps Script

Gists Abstract It is considered that when the current error message of Google Apps Script is expanded, it will be useful for a lot of users. This report introduces a sample script for expanding the error message of Google Apps Script using Gemini Pro API with Google Apps Script. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio opens a world of possibilities.

Flexible Labeling for Gmail using Gemini Pro API with Google Apps Script

Gists Abstract The release of Gemini API is expected to expand the future of Google Apps Script. This report introduces a sample script for flexible email labeling in Gmail using Gemini API with Google Apps Script. Introduction The recent release of the LLM model Gemini as an API on Vertex AI and Google AI Studio opens a world of possibilities. Ref and Ref I believe Gemini API significantly expands the potential of Google Apps Script and paves the way for diverse applications.

Automatically Creating Descriptions of Files on Google Drive using Gemini Pro API with Google Apps Script

Gists Abstract Gemini LLM, now a Vertex AI/Studio API, unlocks easy document summarization and image analysis via Google Apps Script. This report details an example script for automatically creating the description of the files on Google Drive and highlights seamless integration options with API keys. Introduction Recently, the LLM model Gemini has been released and is now available as an API on Vertex AI and Google AI Studio. Ref and Ref This report presents a simple Google Apps Script example for automatically creating descriptions of files on Google Drive using the Gemini Pro API.