monadic-chat 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -3
- data/Gemfile.lock +2 -6
- data/README.md +36 -36
- data/apps/chat/chat.md +9 -10
- data/apps/code/code.md +8 -9
- data/apps/novel/novel.md +7 -8
- data/apps/translate/translate.md +6 -7
- data/bin/monadic-chat +23 -9
- data/doc/img/research-mode-template.svg +1 -1
- data/lib/monadic_app.rb +1 -1
- data/lib/monadic_chat/authenticate.rb +115 -0
- data/lib/monadic_chat/commands.rb +75 -0
- data/lib/monadic_chat/interaction.rb +1 -6
- data/lib/monadic_chat/internals.rb +68 -28
- data/lib/monadic_chat/open_ai.rb +7 -7
- data/lib/monadic_chat/tools.rb +36 -12
- data/lib/monadic_chat/version.rb +1 -1
- data/lib/monadic_chat.rb +37 -166
- data/monadic_chat.gemspec +0 -1
- data/user_apps/boilerplates/boilerplate.json +5 -0
- data/user_apps/boilerplates/boilerplate.md +41 -0
- data/user_apps/boilerplates/boilerplate.rb +85 -0
- data/{apps → user_apps}/linguistic/linguistic.md +7 -8
- data/user_apps/wikipedia/wikipedia.json +3 -0
- data/user_apps/wikipedia/wikipedia.md +38 -0
- data/user_apps/wikipedia/wikipedia.rb +85 -0
- metadata +13 -19
- /data/{apps → user_apps}/linguistic/linguistic.json +0 -0
- /data/{apps → user_apps}/linguistic/linguistic.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b894910f03beb26737b61d52bbe8dccde3afe592ca7366f32d7fd23a04ab5f01
|
4
|
+
data.tar.gz: bc1c6f2f7f6623081fa163a3b8ad285afe67179f4b140d303e46482fcf15faea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c725e1764e683da1adbe8131ea70b67c66babeba8ab51a09d29ba056728120c61aa874510b7f5a599938770f86d136a063c538165ec6edcc9a5847c47af22d3
|
7
|
+
data.tar.gz: 127ad0699ea96e9adf647dfb52564d9ecfc4a32749883bf1e8df6c9b97a125df88b1469270254405bbdecfd63b160c035746990d374972c171a867edcf12174f
|
data/CHANGELOG.md
CHANGED
@@ -24,8 +24,13 @@
|
|
24
24
|
|
25
25
|
## [0.3.3] - 2023-03-26
|
26
26
|
|
27
|
-
- Command line options to directly run individual apps
|
27
|
+
- Command line options to directly run individual apps
|
28
28
|
|
29
|
-
## [0.3.4] - 2023-
|
29
|
+
## [0.3.4] - 2023-04-02
|
30
30
|
|
31
|
-
-
|
31
|
+
- Architecture refined here and there
|
32
|
+
|
33
|
+
## [0.3.5] - 2023-04-05
|
34
|
+
|
35
|
+
- `Wikipedia` app added (experimental, requires GPT-4)
|
36
|
+
- `monadic-chat new/del app_name` command added
|
data/Gemfile.lock
CHANGED
@@ -16,12 +16,11 @@ PATH
|
|
16
16
|
tty-prompt
|
17
17
|
tty-screen
|
18
18
|
tty-spinner
|
19
|
-
wikipedia-client
|
20
19
|
|
21
20
|
GEM
|
22
21
|
remote: https://rubygems.org/
|
23
22
|
specs:
|
24
|
-
addressable (2.8.
|
23
|
+
addressable (2.8.2)
|
25
24
|
public_suffix (>= 2.0.2, < 6.0)
|
26
25
|
blingfire (0.1.8)
|
27
26
|
diff-lcs (1.5.0)
|
@@ -104,12 +103,9 @@ GEM
|
|
104
103
|
unf_ext (0.0.8.2)
|
105
104
|
unicode-display_width (2.4.2)
|
106
105
|
unicode_utils (1.4.0)
|
107
|
-
wikipedia-client (1.17.0)
|
108
|
-
addressable (~> 2.7)
|
109
106
|
wisper (2.0.1)
|
110
107
|
|
111
108
|
PLATFORMS
|
112
|
-
ruby
|
113
109
|
x86_64-darwin-22
|
114
110
|
|
115
111
|
DEPENDENCIES
|
@@ -119,4 +115,4 @@ DEPENDENCIES
|
|
119
115
|
rspec
|
120
116
|
|
121
117
|
BUNDLED WITH
|
122
|
-
2.4.
|
118
|
+
2.4.10
|
data/README.md
CHANGED
@@ -15,7 +15,9 @@
|
|
15
15
|
|
16
16
|
**Change Log**
|
17
17
|
|
18
|
-
- [
|
18
|
+
- [April 05, 2023] `Wikipedia` app added (experimental, requires GPT-4)
|
19
|
+
- [April 05, 2023] `monadic-chat new/del app_name` command
|
20
|
+
- [April 02, 2023] Architecture refined here and there
|
19
21
|
- [March 26, 2023] Command line options to directly run individual apps
|
20
22
|
- [March 24, 2023] `Research` mode now supports chat API in addition to text-completion API
|
21
23
|
- [March 21, 2023] GPT-4 models supported (in `normal` mode)
|
@@ -73,7 +75,7 @@ gem update monadic-chat
|
|
73
75
|
|
74
76
|
### Clone the GitHub Repository
|
75
77
|
|
76
|
-
Alternatively, clone the code from the GitHub repository and follow the steps below.
|
78
|
+
Alternatively, clone the code from the GitHub repository and follow the steps below.
|
77
79
|
|
78
80
|
1. Clone the repo
|
79
81
|
|
@@ -397,39 +399,39 @@ Below is a sample HTML displaying the conversation (paris of an input sentence a
|
|
397
399
|
|
398
400
|
### File Structure
|
399
401
|
|
400
|
-
New Monadic Chat apps must be placed inside the `
|
402
|
+
New Monadic Chat apps must be placed inside the `user_apps` folder. Experimental apps `wikipedia` and `linguistic` are also in this folder. `boilerplates` folder and its contents do not constitute an app; these files are copied when a new app is created.
|
401
403
|
|
402
404
|
```text
|
403
|
-
|
404
|
-
├──
|
405
|
-
│ ├──
|
406
|
-
│ ├──
|
407
|
-
│ └──
|
408
|
-
├──
|
409
|
-
│ ├──
|
410
|
-
│ ├──
|
411
|
-
│ └──
|
412
|
-
├── novel
|
413
|
-
│ ├── novel.json
|
414
|
-
│ ├── novel.md
|
415
|
-
│ └── novel.rb
|
416
|
-
└─── translate
|
417
|
-
├── translate.json
|
418
|
-
├── translate.md
|
419
|
-
└── translate.rb
|
420
|
-
```
|
421
|
-
|
422
|
-
Notice in the figure above that three files with the same name but different extensions (`.rb`, `.json`, and `.md`) are stored under each of the four default app folders. Similarly, when creating a new app, you create these three types of files under a folder with the same name as the app name.
|
423
|
-
|
424
|
-
```text
|
425
|
-
apps
|
405
|
+
user_apps
|
406
|
+
├── boilerplates
|
407
|
+
│ ├── boilerplate.json
|
408
|
+
│ ├── boilerplate.md
|
409
|
+
│ └── boilerplate.rb
|
410
|
+
├── wikipedia
|
411
|
+
│ ├── wikipedia.json
|
412
|
+
│ ├── wikipedia.md
|
413
|
+
│ └── wikipedia.rb
|
426
414
|
└─── linguistic
|
427
415
|
├── linguistic.json
|
428
416
|
├── linguistic.md
|
429
417
|
└── linguistic.rb
|
430
418
|
```
|
431
419
|
|
432
|
-
|
420
|
+
Notice in the figure above that three files with the same name but different extensions (`.rb`, `.json`, and `.md`) are stored under each of the four default app folders.
|
421
|
+
|
422
|
+
The following command will create a new folder and the three files within it using this naming convention.
|
423
|
+
|
424
|
+
```
|
425
|
+
monadic-chat new app_name
|
426
|
+
```
|
427
|
+
|
428
|
+
If you feel like removing an app that you have created before, run:
|
429
|
+
|
430
|
+
```
|
431
|
+
monadic-chat del app_name
|
432
|
+
```
|
433
|
+
|
434
|
+
Let's assume we are creating a new application `linguistic`. In fact, an app with the same name already exists, so this is just for illustrative purposes. Anyway, running `monadic-chat new linguistic` generates the following three files inside `linguistic` folder.
|
433
435
|
|
434
436
|
- `linguistic.rb`: Ruby code to define the "reducer"
|
435
437
|
- `linguistic.json`: JSON template describing GPT's basic behavior in `normal` and `research` modes
|
@@ -476,22 +478,21 @@ Below we will look at this extra template for `research` mode of the `linguistic
|
|
476
478
|
|
477
479
|
<div style="highlight highlight-source-gfm"><pre style="white-space : pre-wrap !important;">{{SYSTEM}}
|
478
480
|
|
479
|
-
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 "
|
481
|
+
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.</pre></div>
|
480
482
|
|
481
483
|
Monadic Chat automatically replaces `{{SYSTEM}}} with the message from the `system` role when the template is sent via API. However, the above text also includes a few additional paragpraphs, including the one instructing the response from GPT to be presented as a JSON object.
|
482
484
|
|
483
485
|
**New Prompt**
|
484
486
|
|
485
487
|
```markdown
|
486
|
-
|
488
|
+
{{PROMPT}}
|
487
489
|
```
|
488
490
|
|
489
491
|
Monadic Chat replaces `{{PROMPT}}` with input from the user when sending the template through the API.
|
490
492
|
|
491
|
-
**
|
493
|
+
**Messages**
|
492
494
|
|
493
495
|
```markdown
|
494
|
-
PAST MESSAGES:
|
495
496
|
{{MESSAGES}}
|
496
497
|
```
|
497
498
|
|
@@ -501,10 +502,8 @@ Monadic Chat replaces `{{MESSAGES}}` with messages from past conversations when
|
|
501
502
|
|
502
503
|
```json
|
503
504
|
{
|
504
|
-
"prompt": "\"We didn't have a camera.\"",
|
505
|
-
"response": "`[S [NP We] [VP [V didn't] [VP [V have] [NP [Det a] [N camera] ] ] ] ] ]`\n\n###\n\n",
|
506
505
|
"mode": "linguistic",
|
507
|
-
"
|
506
|
+
"response": "`[S [NP We] [VP [V didn't] [VP [V have] [NP [Det a] [N camera] ] ] ] ] ]`\n\n###\n\n",
|
508
507
|
"sentence_type": ["declarative"],
|
509
508
|
"sentiment": ["sad"],
|
510
509
|
"summary": "The user saw a beautiful sunset, but did not take a picture because the user did not have a camera.",
|
@@ -515,7 +514,7 @@ This is the core of the extra template for `research` mode.
|
|
515
514
|
|
516
515
|
Note that the extra template is written in Markdown format, so the above JSON object is actually separated from the rest of the template as a [fenced code block](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks).
|
517
516
|
|
518
|
-
The required properties of this JSON object are `
|
517
|
+
The required properties of this JSON object are `mode` and `response`. Other properties are optional. The `mode` property is used to check the app name when saving the conversation data or loading from an external file.
|
519
518
|
|
520
519
|
The JSON object in the `research` mode template is saved in the user’s home directory (`$HOME`) with the file `monadic_chat.json`. The content is overwritten every time the JSON object is updated. Note that this JSON file is created for logging purposes . Modifying its content does not affect the processes carried out by the app.
|
521
520
|
|
@@ -526,7 +525,7 @@ Make sure the following content requirements are all fulfilled:
|
|
526
525
|
|
527
526
|
- keep the value of the "mode" property at "linguistic"
|
528
527
|
- set the new prompt to the "prompt" property
|
529
|
-
- create your response to the new prompt based on "
|
528
|
+
- create your response to the new prompt based on "MESSAGES" and set it to "response"
|
530
529
|
- analyze the new prompt's sentence type and set a sentence type value such as "interrogative", "imperative", "exclamatory", or "declarative" to the "sentence_type" property
|
531
530
|
- analyze the new prompt's sentiment and set one or more sentiment types such as "happy", "excited", "troubled", "upset", or "sad" to the "sentiment" property
|
532
531
|
- summarize the user's messages so far and update the "summary" property with a text of fewer than 100 words using as many discourse markers such as "because", "therefore", "but", and "so" to show the logical connection between the events.
|
@@ -581,6 +580,7 @@ In Monadic Chat, responses from OpenAI's language model APIs (chat API and text
|
|
581
580
|
Thus, the architecture of the `research` mode of Monad Chat, with its ability to generate and manage metadata properties inside the monadic structure, is parallel to the architecture of natural language discourse in general: both can be seen as a kind of "state monad" (Hasebe 2021).
|
582
581
|
## Future Plans
|
583
582
|
|
583
|
+
- Refactoring the current implementation code into `unit`, `map`, and `flatten`
|
584
584
|
- More test cases to verify command line user interaction behavior
|
585
585
|
- Improved error handling mechanism to catch incorrect responses from GPT
|
586
586
|
- Develop a DSL to define templates in a more efficient and systematic manner
|
data/apps/chat/chat.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
{{SYSTEM}}
|
2
2
|
|
3
|
-
Create a response to "NEW PROMPT" from the user and set your response to the "response" property of the JSON object below. The preceding conversation is stored in "
|
3
|
+
Create a response to "NEW PROMPT" from the user and set your response to the "response" property of the JSON object below. The preceding conversation is stored in "MESSAGES".
|
4
4
|
|
5
|
-
|
5
|
+
The preceding conversation is stored in "MESSAGES". In "MESSAGES", "assistant" refers to you. Make your response as detailed as possible.
|
6
6
|
|
7
|
-
|
7
|
+
{{PROMPT}}
|
8
8
|
|
9
|
-
PAST MESSAGES:
|
10
9
|
{{MESSAGES}}
|
11
10
|
|
12
11
|
JSON:
|
@@ -23,23 +22,23 @@ JSON:
|
|
23
22
|
}
|
24
23
|
```
|
25
24
|
|
26
|
-
Make sure the following content requirements are all fulfilled:
|
27
|
-
|
25
|
+
Make sure the following content requirements are all fulfilled: ###
|
28
26
|
- keep the value of the "mode" property at "chat"
|
29
|
-
- create your response to the new prompt based on the
|
27
|
+
- create your response to the new prompt based on the MESSAGES and set it to "response"
|
30
28
|
- if the new prompt is in a language other than the current value of "language", set the name of the new prompt language to "language" and make sure that "response" is in that language
|
31
29
|
- make your response in the same language as the new prompt
|
32
30
|
- analyze the topic of the new prompt and insert it at the end of the value list of the "topics" property
|
33
31
|
- summarize the user's messages so far and update the "summary" property with a text of fewer than 100 words
|
34
32
|
- update the value of the "confidence" property based on the factuality of your response, ranging from 0.00 (not at all confident) to 1.00 (fully confident)
|
35
33
|
- update the value of the "ambiguity" property based on the clarity of the user input, ranging from 0.00 (not at all ambiguous, clearly stated) to 1.00 (fully ambiguous, nonsensical)
|
36
|
-
- avoid giving a response that is the same or similar to one of the previous responses in
|
34
|
+
- avoid giving a response that is the same or similar to one of the previous responses in MESSAGES
|
37
35
|
- program code in the response must be embedded in a code block in the markdown text
|
36
|
+
###
|
38
37
|
|
39
|
-
Make sure the following formal requirements are all fulfilled:
|
40
|
-
|
38
|
+
Make sure the following formal requirements are all fulfilled: ###
|
41
39
|
- do not use invalid characters in the JSON object
|
42
40
|
- escape double quotes and other special characters in the text values in the resulting JSON object
|
43
41
|
- check the validity of the generated JSON object and correct any possible parsing problems before returning it
|
42
|
+
###
|
44
43
|
|
45
44
|
Return your response consisting solely of the JSON object wrapped in "<JSON>\n" and "\n</JSON>" tags.
|
data/apps/code/code.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
{{SYSTEM}}
|
2
2
|
|
3
|
-
Create a response "NEW PROMPT" from the user and set your response to the "response" property of the JSON object shown below. In "
|
3
|
+
Create a response "NEW PROMPT" from the user and set your response to the "response" property of the JSON object shown below. In "MESSAGES", "assistant" refers to you. Make your response as detailed as possible.
|
4
4
|
|
5
|
-
|
5
|
+
{{PROMPT}}
|
6
6
|
|
7
|
-
PAST MESSAGES:
|
8
7
|
{{MESSAGES}}
|
9
8
|
|
10
9
|
JSON:
|
@@ -19,21 +18,21 @@ JSON:
|
|
19
18
|
}
|
20
19
|
```
|
21
20
|
|
22
|
-
Make sure the following content requirements are all fulfilled:
|
23
|
-
|
21
|
+
Make sure the following content requirements are all fulfilled: ###
|
24
22
|
- keep the value of the "mode" property at "chat"
|
25
|
-
- create your response to the new prompt based on "
|
23
|
+
- create your response to the new prompt based on "MESSAGES" and set it to "response"
|
26
24
|
- if the prompt is in a language other than the current value of "language", set the name of the new prompt language to "language" and make sure that "response" is in that language
|
27
25
|
- make your response in the same language as the new prompt
|
28
26
|
- analyze the topic of the new prompt and insert it at the end of the value list of the "topics" property
|
29
27
|
- summarize the user's messages so far and update the "summary" property with a text of fewer than 100 words
|
30
|
-
- avoid giving a response that is the same or similar to one of the previous responses in "
|
28
|
+
- avoid giving a response that is the same or similar to one of the previous responses in "MESSAGES"
|
31
29
|
- program code in the response must be embedded in a code block in the markdown text
|
30
|
+
###
|
32
31
|
|
33
|
-
Make sure the following formal requirements are all fulfilled:
|
34
|
-
|
32
|
+
Make sure the following formal requirements are all fulfilled: ###
|
35
33
|
- do not use invalid characters in the JSON object
|
36
34
|
- escape double quotes and other special characters in the text values in the resulting JSON object
|
37
35
|
- check the validity of the generated JSON object and correct any possible parsing problems before returning it
|
36
|
+
###
|
38
37
|
|
39
38
|
Return your response consisting solely of the JSON object wrapped in "<JSON>\n" and "\n</JSON>" tags.
|
data/apps/novel/novel.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
{{SYSTEM}}
|
2
2
|
|
3
|
-
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 "
|
3
|
+
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.
|
4
4
|
|
5
|
-
|
5
|
+
{{PROMPT}}
|
6
6
|
|
7
|
-
PAST MESSAGES:
|
8
7
|
{{MESSAGES}}
|
9
8
|
|
10
9
|
JSON:
|
@@ -17,18 +16,18 @@ JSON:
|
|
17
16
|
}
|
18
17
|
```
|
19
18
|
|
20
|
-
Make sure the following content requirements are all fulfilled:
|
21
|
-
|
19
|
+
Make sure the following content requirements are all fulfilled: ###
|
22
20
|
- keep the value of the "mode" property at "novel"
|
23
21
|
- create your new paragraph in response to the new prompt and set it to "response"
|
24
|
-
- do not repeat in your response what is already told in "
|
22
|
+
- do not repeat in your response what is already told in "MESSAGES"
|
25
23
|
- make your response as detailed as possible within the maximum limit of 200 words
|
26
24
|
- summarize the user's messages so far and update the "summary" property with a text of fewer than 100 words
|
25
|
+
###
|
27
26
|
|
28
|
-
Make sure the following formal requirements are all fulfilled:
|
29
|
-
|
27
|
+
Make sure the following formal requirements are all fulfilled: ###
|
30
28
|
- do not use invalid characters in the JSON object
|
31
29
|
- escape double quotes and other special characters in the text values in the resulting JSON object
|
32
30
|
- check the validity of the generated JSON object and correct any possible parsing problems before returning it
|
31
|
+
###
|
33
32
|
|
34
33
|
Return your response consisting solely of the JSON object wrapped in "<JSON>\n" and "\n</JSON>" tags.
|
data/apps/translate/translate.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
{{SYSTEM}}
|
2
2
|
|
3
|
-
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 "
|
3
|
+
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. Make your response as detailed as possible.
|
4
4
|
|
5
|
-
|
5
|
+
{{PROMPT}}
|
6
6
|
|
7
|
-
PAST MESSAGES:
|
8
7
|
{{MESSAGES}}
|
9
8
|
|
10
9
|
JSON:
|
@@ -18,17 +17,17 @@ JSON:
|
|
18
17
|
}
|
19
18
|
```
|
20
19
|
|
21
|
-
Make sure the following requirements are all fulfilled:
|
22
|
-
|
20
|
+
Make sure the following requirements are all fulfilled: ###
|
23
21
|
- keep the value of the "mode" property at "translate"
|
24
22
|
- translate the new prompt text to the language specified in the "target_lang" set it to "response" and set the translation to the "response" property
|
25
23
|
- update the "dictionary" property with translation suggested by the user (using parentheses) for specific expressions
|
26
24
|
- add user-suggested translations (translations in parentheses) to the "dictionary" property
|
25
|
+
###
|
27
26
|
|
28
|
-
Make sure the following formal requirements are all fulfilled:
|
29
|
-
|
27
|
+
Make sure the following formal requirements are all fulfilled: ###
|
30
28
|
- do not use invalid characters in the JSON object
|
31
29
|
- escape double quotes and other special characters in the text values in the resulting JSON object
|
32
30
|
- check the validity of the generated JSON object and correct any possible parsing problems before returning it
|
31
|
+
###
|
33
32
|
|
34
33
|
Return your response consisting solely of the JSON object wrapped in "<JSON>\n" and "\n</JSON>" tags.
|
data/bin/monadic-chat
CHANGED
@@ -130,7 +130,7 @@ when 1
|
|
130
130
|
when "readme", "-h"
|
131
131
|
MonadicChat.open_readme
|
132
132
|
when "version", "-v"
|
133
|
-
|
133
|
+
print MonadicChat::PROMPT_SYSTEM.prefix, MonadicChat::VERSION, "\n"
|
134
134
|
else
|
135
135
|
MonadicChat::APPS.each do |app|
|
136
136
|
next unless app == ARGV[0]
|
@@ -139,16 +139,30 @@ when 1
|
|
139
139
|
eval(app.capitalize, binding, __FILE__, __LINE__).new(openai_completion, research_mode: false).run
|
140
140
|
exit
|
141
141
|
end
|
142
|
-
|
142
|
+
print MonadicChat::PROMPT_SYSTEM.prefix, "Unknown command", "\n"
|
143
143
|
end
|
144
144
|
else
|
145
|
-
|
146
|
-
|
145
|
+
if ARGV[0] == "new"
|
146
|
+
if ARGV[1].to_s != "" && !MonadicChat::APPS.include?(ARGV[1])
|
147
|
+
MonadicChat.create_app(ARGV[1])
|
148
|
+
else
|
149
|
+
print MonadicChat::PROMPT_SYSTEM.prefix, "Invalid app name (must be unique)", "\n"
|
150
|
+
end
|
151
|
+
elsif ARGV[0] == "delete" || ARGV[0] == "del" || ARGV[0] == "remove"
|
152
|
+
if MonadicChat::APPS.include?(ARGV[1])
|
153
|
+
MonadicChat.delete_app(ARGV[1])
|
154
|
+
else
|
155
|
+
print MonadicChat::PROMPT_SYSTEM.prefix, "Invalid app name (must exist)", "\n"
|
156
|
+
end
|
157
|
+
else
|
158
|
+
MonadicChat::APPS.each do |app|
|
159
|
+
next unless app == ARGV[0]
|
147
160
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
161
|
+
openai_completion ||= MonadicChat.authenticate(message: false)
|
162
|
+
app_obj = eval(app.capitalize, binding, __FILE__, __LINE__).new(openai_completion, research_mode: false, params: { "model" => "gpt-4" })
|
163
|
+
app_obj.bind(ARGV[1..].join(" "), num_retrials: 2)
|
164
|
+
exit
|
165
|
+
end
|
166
|
+
print MonadicChat::PROMPT_SYSTEM.prefix, "Unknown command", "\n"
|
152
167
|
end
|
153
|
-
puts "Unknown command"
|
154
168
|
end
|