https://github.com/analyticsinmotion/integrate-palm-into-word
How to use Google's PaLM 2 language model in Microsoft Word.
https://github.com/analyticsinmotion/integrate-palm-into-word
bison-text google-bard google-palm large-language-model large-language-models llm microsoft-word palm palm-2 palm2 palm2-in-ms-word pathway-langugae-model text-completion vba-macros
Last synced: 3 months ago
JSON representation
How to use Google's PaLM 2 language model in Microsoft Word.
- Host: GitHub
- URL: https://github.com/analyticsinmotion/integrate-palm-into-word
- Owner: analyticsinmotion
- License: mit
- Created: 2023-05-22T05:49:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T06:00:03.000Z (almost 2 years ago)
- Last Synced: 2025-04-12T23:20:23.594Z (6 months ago)
- Topics: bison-text, google-bard, google-palm, large-language-model, large-language-models, llm, microsoft-word, palm, palm-2, palm2, palm2-in-ms-word, pathway-langugae-model, text-completion, vba-macros
- Language: VBA
- Homepage: https://www.analyticsinmotion.com
- Size: 1.78 MB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Integrate PaLM into Word
[](https://github.com/analyticsinmotion/integrate-palm-into-word/blob/main/LICENSE)


[](https://ai.google/discover/palm2)
[](https://www.analyticsinmotion.com)
## 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.https://github.com/analyticsinmotion/integrate-palm-into-word/assets/52817125/720592f1-8ce8-4249-96a6-fa5c8b0eac1a
## Getting Started
### Dependencies
- Requires an MakerSuite API Key (apply for the waitlist here: https://makersuite.google.com/app/apikey)
- Requires Microsoft Windows 10/11 (https://www.microsoft.com/en-au/windows)
- Requires Microsoft Word 365 (https://www.microsoft.com/en-us)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](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](https://developers.generativeai.google/terms) 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 KeyEach 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 hereIf 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:
- https://blog.google/technology/ai/google-palm-2-ai-large-language-model/
- https://ai.googleblog.com/2022/04/pathways-language-model-palm-scaling-to.html## 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.