Author Archives:

Construct with Collaborators, Call with Work

This article was adapted from a Google Tech on the Toilet (TotT) episode. You can download a printer-friendly version of this TotT episode and post it in your office.

By Shahar Roth 

Classes require various objects and parameters to function. The "Construct with Collaborators, Call with Work" guideline can help you construct effective inputs: 

  • Use the constructor for collaborators—the dependencies that establish the object’s identity. Collaborators stay with the object for its lifetime to enable it to fulfill its ongoing duties.

  • Pass work—the parameters that change with each interaction—to methods. Unique to each call, these inputs provide the specific data needed for an operation such as a file path or database query.

Consider a ReportGenerator that needs a database, a formatter, and a date range to generate a report. The database and formatter, as collaborators, are injected via the constructor, while dateRange, which varies per report generation, is passed as a method parameter to the generate method:

class ReportGenerator {

  private final Database database;

  private final Formatter formatter;


  // database and formatter are passed as collaborators.

  ReportGenerator(Database database, Formatter formatter) {

    this.database = database;

    this.formatter = formatter;

  }


  // dateRange is passed as a parameter.

  Report generate(Range<Instant> dateRange) {

    return formatter.format(database.getRecords(dateRange));

  }

}

A single ReportGenerator object can generate multiple reports with different date ranges:

ReportGenerator generator = new ReportGenerator(database, formatter);

Report report1 = generator.generate(dateRange1);

Report report2 = generator.generate(dateRange2);

Following the "Construct with Collaborators, Call with Work" guideline promotes:

  • Reusability: Enables instances to be used for multiple, distinct operations.

  • Testability: Separates dependency setup from business logic.

  • Cleaner code: Hides implementation dependencies from the object’s users.

  • Predictable behavior: Locks in dependencies at creation time.

Note that the definition of "collaborator" versus "work" depends on the object's identity. For example, a RequestMessage could be a collaborator for a RequestHandler if the handler operates on a single request, or work if the handler processes different requests with each method call.



This entry was posted in Uncategorized on by .

Set custom instructions for Gemini in Google Docs

We are introducing the ability to set custom, persistent instructions for Gemini in Google Docs. These instructions ensure that Gemini adapts to your style, tone, and formatting preferences without needing to repeat them in every conversation, ultimately saving you time and ensuring consistency.

Users can add instructions and rules using Gemini in the side panel of Docs such as "Always respond in bullet points," "When summarizing Docs, always include a 3 bullet points at the top."" or "Use a concise and professional tone for all my documents."

Note that users are currently limited to 1000 active instructions.

Getting started

Rollout pace

Availability

  • Business: Business Starter, Standard, and Plus
  • Enterprise: Enterprise Starter, Standard, and Plus
  • Education: Education Plus
  • Consumer: Google AI Plus, Pro, and Ultra
  • Other Editions: Frontline Plus
  • Education Add-Ons: Google AI Pro for Education, Teaching and Learning
  • Other Add-Ons: AI Expanded Access; AI Ultra Access

Resources

This entry was posted in Uncategorized on by .

Securely manage AI and agent access to Workspace data with the AI control center

Securely managing access for generative AI and agent actions to Workspace data is easier ever than before with the new AI control center in the Admin console. This new capability gives enterprise organizations greater visibility and control, especially for teams with stringent data security and compliance requirements.

With the AI control center, admins will feel empowered to confidently deploy and adopt AI in their organizations through

  • A single pane of glass that provides a centralized view of security and governance settings for generative AI and agent actions
  • More granular security, governance, and auditing capabilities for Gemini and agentic solutions accessing Workspace data
  • Additional integrations with other 1P and 3P AI apps to manage AI access and controls to Workspace data
Additional details
The AI control center has four core modules, each addressing key areas of interest for administrators.

  1. Monitor and control AI access: Provides immediate visibility into who is using AI in your organization. It features direct links to Gemini usage reports and core management settings for the Gemini app, Gemini for Workspace and other AI features. To start, the AI control center will show usage for Gmail, Drive, Docs, Sheets, Slides, Meet, Calendar, Chat, and the Gemini App.
  2. Manage security for AI products: Enables granular authority over specific services, such as Gemini in Meet, allowing admins to ensure every AI surface adheres to domain-specific data and security policies.
  3. Manage fundamental security: Anchors AI usage in a secure environment by surfacing foundational protections like classification labels, trust rules, and data protection rules to prevent oversharing and data leaks also when using AI.
  4. Review privacy, abuse, and compliance standards: Directs admins to Google’s guaranteed safeguards, including our "Secure by Design" architecture and the commitment that your domain's data is never used to train our models.
Throughout the AI control center, certain settings will be marked “Coming soon,” allowing admins to plan longer-term rollouts with future capabilities in mind.

Getting started

  • Admins: The AI control center is available by default in the Google Admin console under Generative AI > AI control center. No manual opt-in is required to access the dashboard. Visit the Help Center to learn more about managing AI security and data privacy.
  • End users: No end user action is required. This feature provides administrative visibility and control within the Admin console.

Rollout pace

Availability

  • Enterprise: Enterprise Standard and Plus

Resources

This entry was posted in Uncategorized on by .

Supercharging LLM inference on Google TPUs: Achieving 3X speedups with diffusion-style speculative decoding

Researchers at UCSD have successfully implemented DFlash, a block-diffusion speculative decoding method, on Google TPUs to bypass the sequential bottlenecks of traditional autoregressive drafting. By "painting" entire blocks of candidate tokens in a single forward pass rather than predicting them one-by-one, the system achieved average speedups of 3.13x, with peak performance nearly doubling that of existing methods like EAGLE-3. This open-source integration into the vLLM ecosystem optimizes TPU hardware by leveraging "free" parallel verification and high-quality draft predictions for complex reasoning tasks.
This entry was posted in Uncategorized on by .

Gemini and Firebase AI Logic enabled Karrot to increase sales with a translation feature built in under 2 weeks

Posted by Thomas Ezan, Sr Developer Relations Engineer and Tracy Agyemang, Product Marketing Manager

Karrot is a hyperlocal, community-driven peer-to-peer marketplace app that enables users to buy, sell, and trade items with other verified users. Since launching in South Korea in 2015, the platform has expanded into global markets, amassing over 43 million registered users.

After launching in North America, engineers at Karrot observed that 30% of users in the region use a non-English device language, such as Spanish. To make the app more accessible, the team wanted to bring seamless translation functionality to Karrot quickly and at scale. The developers determined that the most efficient way to implement quality translations would be through integrating an AI service directly into the app, so they selected the Firebase AI Logic and its Android SDK to access Gemini Flash Lite, which led to higher purchasing conversion among non-English users.


Integrating Gemini Firebase AI Logic

The team initially tested two on-device options: the ML Kit Translation SDK and Gemini Nano. But the team found challenges with each: ML Kit Translation didn’t meet the team’s quality expectations, and Gemini Nano, if it isn’t already on the device, required the user to download the model data.

The team then tested Firebase AI Logic. By calling the Gemini API directly from the app, Firebase AI Logic delivered accuracy at speeds that mirrored a natural conversational cadence.

Integrating Firebase AI Logic into the app was a “remarkably straightforward experience,” according to TaeGyu An, an Android Software Engineer on Karrot’s Mobile Platform team. TaeGyu and the team used the platform’s documentation and code samples to build a proof of concept in under three hours.

This allowed the team to spend more time refining prompts and finding optimal configuration values. “Even without extensive experience writing prompts, the official documentation's guides and tips made it easy to quickly identify the right direction for improving translation quality,” said WonJoong Lee, an Android Software Engineer on Karrot’s North America Product Team.

This low barrier to entry and rapid turnaround time enabled engineers to keep development costs low and go from proof of concept to production code in just two weeks—all without setting up a dedicated backend. That also freed up time to focus on UX and policy design, such as opt-in behavior and the conditions for the translation banner.

Driving sales with enhanced AI features


Since implementing translation using Gemini and Firebase AI Logic, the Karrot team observed higher purchasing conversion among non-English users, indicating that the translation feature is helping drive sales.

Of users who used a non-English device language, one in three of them who were shown the translation banner actively used the feature. The team has also observed that buyers offered translation functionality were 2.4X more likely to start a chat with a seller than those who weren’t.

The flexibility and simplicity of deploying Firebase AI Logic has led the team to explore other features to simplify the workstreams of its engineers. “It’s rewarding to build features that scale across diverse Android devices while helping neighbors connect and interact within their local communities,” concluded TaeGyu.

Going forward, the team plans to implement Server Prompt Templates to adjust prompts after release without shipping a new version of the app. This, combined with Remote Config, should help the team iterate faster and reduce operational overhead.

Get started

Learn how to build Gemini-enabled features like AI translations and in-app personalization and more with Firebase AI Logic to deliver better experiences to your users, faster.

This entry was posted in Uncategorized on by .