Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word
Create a chatbot in Microsoft Word powered by ChatGPT
https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word
analytics-in-motion chat chat-application chatbot chatgpt chatgpt-bot chatgpt-chat-completion chatgpt-chat-history chatgpt-in-ms-word chatgpt-in-word gpt-35-turbo gpt-4 gpt-chatbot gpt4 microsoft-word vba vba-macros vba-modules
Last synced: 3 months ago
JSON representation
Create a chatbot in Microsoft Word powered by ChatGPT
- Host: GitHub
- URL: https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word
- Owner: analyticsinmotion
- License: mit
- Created: 2023-03-16T00:22:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T05:23:16.000Z (about 1 year ago)
- Last Synced: 2023-10-23T06:25:19.591Z (about 1 year ago)
- Topics: analytics-in-motion, chat, chat-application, chatbot, chatgpt, chatgpt-bot, chatgpt-chat-completion, chatgpt-chat-history, chatgpt-in-ms-word, chatgpt-in-word, gpt-35-turbo, gpt-4, gpt-chatbot, gpt4, microsoft-word, vba, vba-macros, vba-modules
- Language: VBA
- Homepage: https://www.analyticsinmotion.com
- Size: 1.54 MB
- Stars: 39
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![analytics-in-motion-add-gpt-chatbot-to-microsoft-word](https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word/assets/52817125/7697b70f-be2f-40b2-9a67-8efa8c79796a)
:speech_balloon: Add GPT Chatbot to Microsoft Word
[![ChatGPT](https://img.shields.io/badge/ChatGPT-74aa9c?style=badge&logo=openai&logoColor=white)](https://chat.openai.com)
![Microsoft Word](https://img.shields.io/badge/Microsoft_Word-2B579A?logo=microsoft-word&logoColor=white)
![Windows](https://img.shields.io/badge/Windows-0078D6?logo=windows&logoColor=white)
![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00)
![](https://img.shields.io/badge/Maintained%3F-yes-green.svg)
[![CI](https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word/actions/workflows/blank.yml/badge.svg)](https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word/actions/workflows/blank.yml)
[![MIT license](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/analyticsinmotion/add-gpt-chatbot-to-microsoft-word/blob/main/LICENSE.md)
[![OpenAI](https://img.shields.io/badge/OpenAI-000000?style=badge&logo=openai&logoColor=white)](https://openai.com)
[![Analytics in Motion](https://raw.githubusercontent.com/analyticsinmotion/.github/main/assets/images/analytics-in-motion-github-badge-rounded.svg)](https://www.analyticsinmotion.com)
Create an intelligent chatbot in Microsoft Word powered by ChatGPT## 1. Description
Easily access ChatGPT's awesome chatbot capabilies in Microsoft Word. This application captures the conversation history between a user and the chatbot. By utilizing conversation history, the chatbot can mimic an awareness of context and thus provide responses that make more sense.
https://user-images.githubusercontent.com/52817125/225483447-b59057f0-8cd8-4a75-9062-a0fb75ccf5ac.mp4
## 2. Getting Started
### 2.1 Dependencies
- Requires an OpenAI API Key (create an account and get API Key at https://chat.openai.com)
- 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 of the [costs](https://openai.com/pricing) associated with using the OpenAI API when utilizing this project.
### 2.2 AI Models
This application uses the following OpenAI model:
| Model | Description | Max tokens | Training data |
| ------------- | ------------- |------------- | ------------- |
| gpt-3.5-turbo | Most capable GPT-3.5 model and optimized
for chat at 1/10th the cost of text-davinci-003.
Will be updated with our latest model iteration. | 4,096 tokens | Up to Sep 2021 |Further information about all OpenAI models can be found here: https://platform.openai.com/docs/models/overview
We endeavour to test and integrate newer models when they are become Generally Available (GA). Models released as a 'Limited Beta' will not be integrated until they become GA.
### 2.3 OpenAI Status
Should you receive error messages for a period of 5 minutes or more, please check the Chat Uptime status at the following link: https://status.openai.com/
## 3. Instructions
- To start a chat, write a message anywhere in Microsoft Word
- Select your message and click the *Chat Completion* button in the AI Assistant tab
- Wait for the model to respond
- The chat response will appear under initial message
- Repeat the steps above to continue the chat
To chat about a new topic simply click the *Chat Reset* button in the AI Assistant tab
### 3.1 Chat Completion Example 1
User Message #1
```
Who won the world series in 2020?
```Chatbot Reply
```
The Los Angeles Dodgers won the World Series in 2020.
```User Message #2
```
Where was it played?
```Chatbot Reply
```
The 2020 World Series was played in Arlington, Texas at Globe Life Field, the home stadium of the Texas Rangers.
```Conversation Flow
> User: Who won the world series in 2020?
> > Chatbot: The Los Angeles Dodgers won the World Series in 2020.> User: Where was it played?
> > Chatbot: The 2020 World Series was played in Arlington, Texas at Globe Life Field, the home stadium of the Texas Rangers.
## 4. Installation
There are 4 basic steps in order to add a ChatGPT button into Microsoft Word:
1. Enable the Developer Tab
2. Import the VBA script files
3. Create the Chat Completion and Chat Reset buttons
4. Add your OpenAI APIKeyEach of these steps are fully outlined below.
### 4.1 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### 4.2 Import the Chat.bas and ChatReset.bas files
**Step 1** - Download and Save the latest Chat.bas and ChatReset.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** - Add the two .bas files
- Select the Chat.bas file and click Open
- Select the ChatReset.bas file and click Open### 4.3 Add your Chat Completion and Chat Reset buttons into the Microsoft Word Ribbon
*Please Note:* This project closely relates to two of our other projects:
- **Add ChatGPT to Microsoft Word** - project found here
- **Create Images with DALL·E in Microsoft Word** - project found hereIf you have have already added one or both 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 **ChatBot**
**Step 4** - Select Macros in the Choose Commands from dropdown box
**Step 5** - Select the Chat Macro and click Add >>
**Step 6** - Rename button to **Chat Completion**, select a Symbol and click OK
**Step 7** - Repeat Steps 5 & 6 to to create a **Chat Reset** button
- Ensure you select the ChatReset Macro to link to your Chat Reset button in this stepAfter the preceding steps have been completed the Microsoft Word screen should look like the following:
### 4.4 Add your OpenAI APIKey into Windows
**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 **OPENAI_API_KEY** in the first field and your OpenAI APIKEY in the variable value field. Then click OK.
**Step 5** - **IMPORTANT** You must restart Windows to apply the new environment variable
## 5. Best Practices for API Key Safety
Your OpenAI APIKEY key/s should be kept secure and private at all times.
Please follow the best practices guide for API security from OpenAI
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety