2 | 3 |

Highly configurable CLI client app for OpenAI chat/text-completion API
6 | 7 |8 | 9 | > **Note** 10 | > 11 | > **Monadic Chat** is currently being actively developed as a web browser application. The command-line version has been renamed to **Monadic Chat CLI**. New features will mainly be implemented in the web application version. At present, both versions have many common features, but please note that the format of the exported data files and the specifications for creating custom applications are different from each other. 12 | 13 | - Monadic Chat: [https://github.com/yohasebe/monadic-chat](https://github.com/yohasebe/monadic-chat) (active) 14 | - Monadic Chat CLI: [https://github.com/yohasebe/monadic-chat-cli](https://github.com/yohasebe/monadic-chat-cli) (this repo; less active) 15 | 16 |
17 | 18 |
19 |
20 |
23 |
24 |
27 | 28 | **Change Log** 29 | 30 | - [August 27, 2024] `gpt-4o-2024-08-06` set as the default model for `research` mode again 31 | - [August 15, 2024] `chatgpt-4o-latest` set as the default model for `research` mode 32 | - [July 19, 2024] `gpt-4o-mini` set as the default model for `normal` mode 33 | - [May 13, 2024] `gpt-4o` set as the default model for both `normal` and `research` modes 34 | - [February 9, 2024] Minor update; default model changed to `gpt-3.5-turbo-0125` 35 | - [November 10, 2023] Stability improvement; default model changed to `gpt-3.5-turbo` 36 | - [October 07, 2023] Stability improvement; default model changed to `gpt-3.5-turbo-0613` 37 | - [June 11, 2023] The repository renamed to `monadic-chat-cli` 38 | - [April 05, 2023] `Wikipedia` app added (experimental) 39 | - [April 05, 2023] `monadic-chat new/del app_name` command 40 | - [April 02, 2023] Architecture refined here and there 41 | - [March 26, 2023] Command line options to directly run individual apps 42 | - [March 24, 2023] `Research` mode now supports chat API in addition to text-completion API 43 | - [March 21, 2023] GPT-4 models supported (in `normal` mode) 44 | - [March 20, 2023] Text and figure in "How the research mode workds" section updated 45 | - [March 13, 2023] Text on the architecture of the `research` mode updated in accordance with Version 0.2.0 46 | 47 | ## Introduction 48 | 49 | **Monadic Chat** is a user-friendly command-line client application that utilizes OpenAI’s Text Completion API and Chat API to facilitate ChatGPT-style conversations with OpenAI’s large language models (LLM) on any terminal application of your choice. 50 | 51 | The conversation history can be saved in a JSON file, which can be loaded later to continue the conversation. Additionally, the conversation data can be converted to HTML and viewed in a web browser for better readability. 52 | 53 | Monadic Chat includes four pre-built apps (`Chat`, `Code`, `Novel`, and `Translate`) that are designed for different types of discourse through interactive conversation with the LLM. Users also have the option to create their own apps by writing new templates. 54 | 55 | Monadic Chat's `normal` mode enables ChatGPT-like conversations on the command line. The `research` mode has a mechanism to handle various related information as "state" behind the conversation. This allows, for example, to retrieve the current conversation *topic* at each utterance turn, and to keep its development as a list. 56 | 57 | ## Dependencies 58 | 59 | - Ruby 2.6.10 or greater 60 | - OpenAI API Token 61 | - A command line terminal app such as: 62 | - Terminal or [iTerm2](https://iterm2.com/) (MacOS) 63 | - [Alacritty](https://alacritty.org/) (Multi-platform) 64 | - [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal) (Windows) 65 | - GNOME Terminal (Linux) 66 | 67 | > **Note on Using Monadic Chat on Windows** 68 | > Monadic Chat does not support running on Windows, but you can install and use Linux Destribution on WSL2. Or you can use it without WSL2 by following these steps: 69 | > 70 | > 1. install Windows Terminal 71 | > 2. install [Git Bash](https://gitforwindows.org/) (make sure to check the `Install profile for Windows Terminal` checkbox 72 | > 3. install Ruby with [Ruby Installer](https://rubyinstaller.org/) 73 | > 4. Open Windows Terminal with Git Bash profile and follow the instruction below. 74 | 75 | ## Installation 76 | 77 | ### Using RubyGems 78 | 79 | Execute the following command in an environment where Ruby 2.6.10 or higher is installed. 80 | 81 | ```text 82 | gem install monadic-chat 83 | ``` 84 | 85 | Then run the command to start the app: 86 | ```text 87 | monadic-chat 88 | ``` 89 | 90 | To update: 91 | 92 | ```text 93 | gem update monadic-chat 94 | ``` 95 | 96 | ### Clone the GitHub Repository 97 | 98 | Alternatively, clone the code from the GitHub repository and follow the steps below. 99 | 100 | 1. Clone the repo 101 | 102 | ```text 103 | git clone https://github.com/yohasebe/monadic-chat.git 104 | ``` 105 | 106 | 2. Install dependencies 107 | 108 | ```text 109 | cd monadic-chat 110 | bundle update 111 | ``` 112 | 113 | 3. Grant permission to the executable 114 | 115 | ```text 116 | chmod +x ./bin/monadic-chat 117 | ``` 118 | 119 | 4. Run the executable 120 | 121 | ```text 122 | ./bin/monadic-chat 123 | ``` 124 | 125 | ## Usage 126 | 127 | ### Authentication 128 | 129 | When you start Monadic Chat with the `monadic-chat` command for the first time, you will be asked for an OpenAI access token. If you do not have one, create an account on the [OpenAI](https://platform.openai.com/) website and obtain an access token. 130 | 131 |
134 |
135 |
152 |
153 |
195 |
196 |
254 |
255 |
256 |
257 |
272 |
273 |
274 |
275 |
298 |
299 |
411 |
412 | Below is a sample HTML displaying the conversation (paris of an input sentence and its syntactic structure) and metadata.
413 |
414 |
417 |
418 | {{SYSTEM}}
500 |
501 | Create a response to "NEW PROMPT" from the user and set your response to the "response" property of the JSON object shown below. The preceding conversation is stored in "MESSAGES". In "MESSAGES", "assistant" refers to you.