Codelab: Using Gemini Code Assist to explore and enhance Generative AI Document Summarization Jump Start Solution

Romin Irani
Google Cloud - Community
3 min readMay 2, 2024

--

Google Cloud Jump Start solutions are pre-built sample applications and infrastructure best-practices that you can deploy within a few clicks in your own Google Cloud account.

If you would like an introduction to Jump Start Solutions, check out my blog post titled Super charge your Google Cloud Learning with Jump Start Solutions.

This post is focused on a codelab that you can do for the following:

  1. Understand one of the Jump Start Solutions — Generative AI Document Summarization
  2. Use Gemini Code Assist to help you understand the code and develop a new feature in the Jump Start Solution.

Generative AI Documentation Summarization — The solution

As the Jump Start solution documentation states, “This solution leverages Vertex AI Generative AI Large Language Models (LLM) to process and summarize documents on demand.”

This solution deploys a pipeline that is triggered when you add a new PDF document to your Cloud Storage bucket. The pipeline extracts text from your document (using Vision API OCR feature), creates a summary (via a Vertex AI LLM model) from the extracted text, and stores the summary in a database (BigQuery) for you to view and search.

You can read more on the official documentation here but first the architecture diagram, which will make things more clear. Focus on the blocks outlined in red color, since the codelab is focused on that.

You can see from the flow that trigger and summarization of the document is a manual process. You have to trigger it by uploading a PDF into the specific Cloud Storage bucket and then the Cloud Function gets triggered, which will extract the Text from the document, summarize and write the results to both Cloud Storage and BigQuery.

The codelab that you can execute to understand this existing solution, do a sample run and then develop a new functionality is available here:

As part of the codelab, you will setup Gemini Code Assist, an AI assistant available in Google Cloud, that will allow you to inspect the source code for the solution, take assistance to understand some parts of the code via the “Explain this” prompt and more. (Step 6 in the codelab)

The codelab also contains steps to do a manual execution of the flow via a sample PDF (Research paper). (Step 7 in the codelab)

Use Gemini Code Assist to develop new functionality

As mentioned, the Jump Start Solution presents a manual process i.e. you have to upload the sample PDF to a Google Cloud Storage bucket. Our goal is to take this further and develop new functionality i.e. build out a web front-end that allows you to upload the file that needs to be summarized.

To build out this functionality, you will need to do the following at a high level:

  1. Develop the Web assets (HTML, Javascript, CSS) for the upload form.
  2. Build out a server side functionality that will accept the uploaded file, extract out the contents and the use Google Cloud Storage client APIs to write the object blob to the Google Cloud Storage bucket.

How about using Gemini Code Assist to help you out with source code that can speed up the development of the above functionality? That is exactly what is demonstrated in the codelab. (Step 8 in the codelab)

Bonus

The codelab also utilizes Code Assist to demonstrate how you can work with it to get information on:

  • Deploying the application you developed to Cloud Run
  • Enhance the Web application by throwing in some CSS Styling

Hope you enjoy the codelab. Use this codelab to understand the process of taking any existing solution and using Code Assist to understand the source code and incrementally enhance the application.

--

--