Skip to content

analyticsinmotion/integrate-palm-into-word

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrate PaLM into Word

MIT license   Windows   Microsoft Word   Google   Analytics in Motion  

Description

Rapidly test, utilize, and compare Google's latest language model PaLM2 in Microsoft Word. PaLM 2 is a state-of-the-art language model that boasts upgraded features in terms of its multilingual capacity, reasoning ability, and coding capabilities. By integrating PaLM 2 into Microsoft Word, this project aims to make the latest in Google's advanced AI capabilities directly accessible and easy to use.

demo-how-to-use-palm-in-word.mp4

Getting Started

Dependencies

Please be aware that access to PaLM API and Makersuite are currently only available in the United States. Users will receive a "400:Bad Request" message should they try to use this project outside the available regions. To monitor available regions please check here: https://developers.generativeai.google/available_regions

In addition, the PaLM API is currently in public preview. Please read the PaLM API and MakerSuite Additional Terms of Service for more information.

Installation

There are 4 basic steps in order to add PaLM's Text Generation capability into Microsoft Word:

  1. Enable the Developer Tab
  2. Import the VBA script file
  3. Create the PaLM Text Completion button
  4. Add your MakerSuite API Key

Each of these steps are fully outlined in the expandable sections below.

 Enable the Developer Tab

The Developer tab isn't displayed by default, but you can add it to the ribbon.

Step 1 - On the File tab, go to Options > Customize Ribbon.

Step 2 - Under Customize the Ribbon and under Main Tabs, select the Developer check box.


The latest instructions to enable the Developer Tab from Microsoft can be found here: https://support.microsoft.com/en-us/office/show-the-developer-tab-in-word-e356706f-1891-4bb8-8d72-f57a51146792

 Import the VBA script file

Step 1 - Download and Save the latest PalmText.bas file from the src/windows folder in this repository.

Keep the location of where the file is saved as you will need it later.

Step 2 - On the Developer tab, click the Visual Basic button.

Step 3 - On the File tab, go to Import File...


 

Step 4 - Select the PalmText.bas file and click Open

 Create the PaLM Text Completion button

Please Note: This project uses the same ribbon as three of our other projects:

  • Add ChatGPT to Microsoft Word - project can be found here
  • Create Images with DALL·E in Microsoft Word - project can be found here
  • Add GPT Chatbot to Microsoft Word - project can be found here

If you have have already added any one of these projects into Microsoft Word you can start at Step 3 of this section.

Step 1 - Add a new tab

  • On the File tab, go to Options > Customize Ribbon
  • Click New Tab


 

Step 2 - Rename the New Tab to AI Assistant


 

Step 3 - Rename New Group (Custom) to PaLM


 

Step 4 - Select Macros in the Choose Commands from dropdown box


 

Step 5 - Select the PaLMText Macro and click Add >>


 

Step 6 - Rename button from Normal.PalmText.PalmText to Text Completion, select a Symbol and click OK


 

After the preceding steps have been completed the Microsoft Word screen should look like the following:


 Add your MakerSuite API Key

Step 1 - Open the Start menu and start typing "environment variables". When the best match appears click "Edit the system environment variables" result.


 

Step 2 - Click the "Environment variables" button under the "Advanced" tab.


 

Step 3 - Create a new user variable by clicking "New" under the "User Variables" section.


 

Step 4 - Type the variable name GOOGLE_PALM_API_KEY in the first field and your MakerSuite API KEY in the variable value field. Then click OK.


 

Step 5 - IMPORTANT You must restart Windows to apply the new environment variable


AI Model Information

This application uses the following Pathways Language Model:

Generation Model Description Max Input Max Output Temperature top_p top_k
PaLM 2 text-bison-001 Model targeted for text generation 8,196 tokens 1,024 tokens 0.7 0.95 40

Further information about this model can be found here:

Best Practices for API Key Safety

Your MakerSuite API KEY key/s should be kept secure and private at all times.

Please follow the best practices guide for API security from Google:
https://support.google.com/googleapi/answer/6310037?hl=en


Disclaimers

  • This project/repository is an independent initiative created for testing purposes and convenience.
  • This project/repository is not affiliated with, endorsed, approved or sponsored by Microsoft Corporation, its subsidiaries or any other affiliates.
  • This project/repository is not affiliated with, endorsed, approved or sponsored by Alphabet Inc., its subsidiary Google or any other affiliates.
  • This project is experimental and contains API's and code that are not ready for any type of Production usage. Support and/or new releases may be limited.