!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())

[Skip to main content](#__docusaurus_skipToContent_fallback)

LangChain v0.2 is coming soon! Preview the new docs [here](/v0.2/docs/introduction/).

[

![🦜️🔗 Langchain](/v0.1/img/brand/wordmark.png)![🦜️🔗 Langchain](/v0.1/img/brand/wordmark-dark.png)

](/v0.1/)[Docs](/v0.1/docs/get_started/introduction/)[Use cases](/v0.1/docs/use_cases/)[Integrations](/v0.1/docs/integrations/platforms/)[API Reference](https://api.js.langchain.com)

[More](#)

*   [People](/v0.1/docs/people/)
*   [Community](/v0.1/docs/community/)
*   [Tutorials](/v0.1/docs/additional_resources/tutorials/)
*   [Contributing](/v0.1/docs/contributing/)

[v0.1](#)

*   [v0.2](https://js.langchain.com/v0.2/docs/introduction)
*   [v0.1](/v0.1/docs/get_started/introduction/)

[🦜🔗](#)

*   [LangSmith](https://smith.langchain.com)
*   [LangSmith Docs](https://docs.smith.langchain.com)
*   [LangChain Hub](https://smith.langchain.com/hub)
*   [LangServe](https://github.com/langchain-ai/langserve)
*   [Python Docs](https://python.langchain.com/)

[Chat](https://chatjs.langchain.com)[](https://github.com/langchain-ai/langchainjs)

Search

*   [Get started](/v0.1/docs/get_started/)
    
    *   [Introduction](/v0.1/docs/get_started/introduction/)
    *   [Installation](/v0.1/docs/get_started/installation/)
    *   [Quickstart](/v0.1/docs/get_started/quickstart/)
*   [LangChain Expression Language](/v0.1/docs/expression_language/)
    
    *   [Get started](/v0.1/docs/expression_language/get_started/)
    *   [Why use LCEL?](/v0.1/docs/expression_language/why/)
    *   [Interface](/v0.1/docs/expression_language/interface/)
    *   [Streaming](/v0.1/docs/expression_language/streaming/)
    *   [How to](/v0.1/docs/expression_language/how_to/routing/)
        
    *   [Cookbook](/v0.1/docs/expression_language/cookbook/)
        
    *   [LangChain Expression Language (LCEL)](/v0.1/docs/expression_language/)
*   [Modules](/v0.1/docs/modules/)
    
    *   [Model I/O](/v0.1/docs/modules/model_io/)
        
    *   [Retrieval](/v0.1/docs/modules/data_connection/)
        
    *   [Chains](/v0.1/docs/modules/chains/)
    *   [Agents](/v0.1/docs/modules/agents/)
        
    *   [More](/v0.1/docs/modules/memory/)
        
*   [Security](/v0.1/docs/security/)
*   [Guides](/v0.1/docs/guides/)
    
*   [Ecosystem](/v0.1/docs/ecosystem/)
    
    *   [Integrations](/v0.1/docs/ecosystem/integrations/)
        
        *   [Databerry](/v0.1/docs/ecosystem/integrations/databerry/)
        *   [Helicone](/v0.1/docs/ecosystem/integrations/helicone/)
        *   [Lunary](/v0.1/docs/ecosystem/integrations/lunary/)
        *   [Google MakerSuite](/v0.1/docs/ecosystem/integrations/makersuite/)
        *   [Unstructured](/v0.1/docs/ecosystem/integrations/unstructured/)
    *   [Integrating with LangServe](/v0.1/docs/ecosystem/langserve/)
    *   [LangSmith](https://docs.smith.langchain.com)
*   [LangGraph](/v0.1/docs/langgraph/)
*   * * *
    

*   [](/v0.1/)
*   [Ecosystem](/v0.1/docs/ecosystem/)
*   [Integrations](/v0.1/docs/ecosystem/integrations/)
*   Google MakerSuite

On this page

Google MakerSuite
=================

Google's [MakerSuite](https://makersuite.google.com/) is a web-based playground for creating and saving chat, text, and "data" prompts that work with the Google PaLM API and model. These prompts include the text, which may include "test input" that act as template parameters, and parameters for the model including the model name, temperature, etc.

LangChain.js provides the `MakerSuiteHub` class which lets you pull this prompt from Google Drive, where they are saved. Once pulled, you can convert the prompt into a LangChain Template, an LLM Model, or a chain that combines the two. This hub class has a simple time-based in-memory cache of prompts, so it is not always accessing the prompt saved in Google Drive.

Using MakerSuite in this way allows you to treat it as a simple Content Management System (CMS) of sorts or allows separation of tasks between prompt authors and other developers.

Setup[​](#setup "Direct link to Setup")
---------------------------------------

You do not need any additional packages beyond those that are required for either the Google PaLM [text](/v0.1/docs/integrations/llms/google_palm/) or [chat](/v0.1/docs/integrations/chat/google_palm/) model:

*   npm
*   Yarn
*   pnpm

    npm install google-auth-library @google-ai/generativelanguage

    yarn add google-auth-library @google-ai/generativelanguage

    pnpm add google-auth-library @google-ai/generativelanguage

Credentials and Authorization[​](#credentials-and-authorization "Direct link to Credentials and Authorization")
---------------------------------------------------------------------------------------------------------------

You will need two sets of credentials:

*   An API Key to access the PaLM API.
    
    Create this at [Google MakerSuite](https://makersuite.google.com/app/apikey). Then set the key as `GOOGLE_PALM_API_KEY` environment variable.
    
*   Credentials for a service account that has been permitted access to the Google Drive APIs.
    
    These credentials may be used in one of three ways:
    
    *   You are logged into an account (using `gcloud auth application-default login`) permitted to that project.
    *   You are running on a machine using a service account that is permitted to the project.
    *   You have downloaded the credentials for a service account that is permitted to the project and set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of this file.

This service account should also be permitted to the MakerSuite folder in Google Drive or to the specific prompt file itself. Even if the prompt file is permitted for anyone to read - you will still need a service account that is permitted to access Google Drive.

The Prompt File ID[​](#the-prompt-file-id "Direct link to The Prompt File ID")
------------------------------------------------------------------------------

The easiest way to get the ID of the prompt file is to open it in MakerSuite and examine the URL. The URL should look something like:

    https://makersuite.google.com/app/prompts/1gxLasQIeQdwR4wxtV_nb93b_g9f0GaMm

The final portion of this, `1gxLasQIeQdwR4wxtV_nb93b_g9f0GaMm` is the ID.

We will be using this in our examples below. This prompt contains a Template that is equivalent to:

    What would be a good name for a company that makes {product}

With model parameters set that include:

*   Model name: Text Bison
*   Temperature: 0.7
*   Max outputs: 1
*   Standard safety settings

Use[​](#use "Direct link to Use")
---------------------------------

The most typical way to use the hub consists of two parts:

1.  Creating the `MakerSuiteHub` class once.
2.  Pulling the prompt, getting the chain, and providing values for the template to get the result.

    // Create the hub classimport { MakerSuiteHub } from "langchain/experimental/hubs/makersuite/googlemakersuitehub";const hub = new MakerSuiteHub();// Pull the prompt, get the chain, and invoke it with the template valuesconst prompt = await hub.pull("1gxLasQIeQdwR4wxtV_nb93b_g9f0GaMm");const result = await prompt.toChain().invoke({ product: "socks" });console.log("text chain result", result);

### Configuring the hub[​](#configuring-the-hub "Direct link to Configuring the hub")

Since the hub implements a basic in-memory time-based cache, you can configure how long until a prompt that is saved in the cache will be reloaded.

This value defaults to 0, indicating it will always be loaded from Google Drive, or you can set it to the number of milliseconds it will be valid in the cache:

    const hub = new MakerSuiteHub({  cacheTimeout: 3600000, // One hour});

### Getting the Template or Model[​](#getting-the-template-or-model "Direct link to Getting the Template or Model")

In some cases, you may need to get just the template or just the model that is represented by the prompt.

    const template = prompt.toTemplate();const textModel = prompt.toModel() as GooglePaLM;const chatModel = prompt.toModel() as ChatGooglePaLM;

* * *

#### Help us out by providing feedback on this documentation page:

[

Previous

Lunary

](/v0.1/docs/ecosystem/integrations/lunary/)[

Next

Unstructured

](/v0.1/docs/ecosystem/integrations/unstructured/)

*   [Setup](#setup)
*   [Credentials and Authorization](#credentials-and-authorization)
*   [The Prompt File ID](#the-prompt-file-id)
*   [Use](#use)
    *   [Configuring the hub](#configuring-the-hub)
    *   [Getting the Template or Model](#getting-the-template-or-model)

Community

*   [Discord](https://discord.gg/cU2adEyC7w)
*   [Twitter](https://twitter.com/LangChainAI)

GitHub

*   [Python](https://github.com/langchain-ai/langchain)
*   [JS/TS](https://github.com/langchain-ai/langchainjs)

More

*   [Homepage](https://langchain.com)
*   [Blog](https://blog.langchain.dev)

Copyright © 2024 LangChain, Inc.