monadic-chat 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +28 -28
- data/README.md +3 -2
- data/lib/monadic_chat/open_ai.rb +6 -11
- data/lib/monadic_chat/version.rb +1 -1
- data/lib/monadic_chat.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 840f1afe3ac1bac2709058c004e0181bc35dce391ac2774575cc7da3de5a31af
|
|
4
|
+
data.tar.gz: a7d82295925a59e375c878e90832457e38a3b675e4ee6e952dd641b9053cf972
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2577863d5326aa6b442906d71fbd0e1478300657597362e4c0bac1e42f8e5fc46ccf9b88ec515df53d96b4b21e7efd43cfa5884daf5ce65713324b0803e8a893
|
|
7
|
+
data.tar.gz: 3b3c673acf3c2c46147dfaf95fd80c5c6a7fd88eaec22ef913816bf3da114f49af9c54bda36e31beff5149ac0ed280812ae42711232661397a2f3f6cb4c4c5c7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
monadic-chat (0.4.
|
|
4
|
+
monadic-chat (0.4.2)
|
|
5
5
|
blingfire
|
|
6
6
|
http
|
|
7
7
|
kramdown
|
|
@@ -20,21 +20,23 @@ PATH
|
|
|
20
20
|
GEM
|
|
21
21
|
remote: https://rubygems.org/
|
|
22
22
|
specs:
|
|
23
|
-
addressable (2.8.
|
|
23
|
+
addressable (2.8.6)
|
|
24
24
|
public_suffix (>= 2.0.2, < 6.0)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
base64 (0.2.0)
|
|
26
|
+
bigdecimal (3.1.6)
|
|
27
|
+
blingfire (0.2.1)
|
|
28
|
+
diff-lcs (1.5.1)
|
|
29
|
+
domain_name (0.6.20240107)
|
|
29
30
|
ffi (1.16.3)
|
|
30
31
|
ffi-compiler (1.0.1)
|
|
31
32
|
ffi (>= 1.0.0)
|
|
32
33
|
rake
|
|
33
|
-
http (5.
|
|
34
|
+
http (5.2.0)
|
|
34
35
|
addressable (~> 2.8)
|
|
36
|
+
base64 (~> 0.1)
|
|
35
37
|
http-cookie (~> 1.0)
|
|
36
38
|
http-form_data (~> 2.2)
|
|
37
|
-
llhttp-ffi (~> 0.
|
|
39
|
+
llhttp-ffi (~> 0.5.0)
|
|
38
40
|
http-cookie (1.0.5)
|
|
39
41
|
domain_name (~> 0.5)
|
|
40
42
|
http-form_data (2.3.0)
|
|
@@ -42,29 +44,30 @@ GEM
|
|
|
42
44
|
rexml
|
|
43
45
|
launchy (2.5.2)
|
|
44
46
|
addressable (~> 2.8)
|
|
45
|
-
llhttp-ffi (0.
|
|
47
|
+
llhttp-ffi (0.5.0)
|
|
46
48
|
ffi-compiler (~> 1.0)
|
|
47
49
|
rake (~> 13.0)
|
|
48
|
-
oj (3.16.
|
|
50
|
+
oj (3.16.3)
|
|
51
|
+
bigdecimal (>= 3.0)
|
|
49
52
|
pastel (0.8.0)
|
|
50
53
|
tty-color (~> 0.5)
|
|
51
|
-
public_suffix (5.0.
|
|
52
|
-
rake (13.0
|
|
54
|
+
public_suffix (5.0.4)
|
|
55
|
+
rake (13.1.0)
|
|
53
56
|
rexml (3.2.6)
|
|
54
|
-
rouge (4.
|
|
55
|
-
rspec (3.
|
|
56
|
-
rspec-core (~> 3.
|
|
57
|
-
rspec-expectations (~> 3.
|
|
58
|
-
rspec-mocks (~> 3.
|
|
59
|
-
rspec-core (3.
|
|
60
|
-
rspec-support (~> 3.
|
|
61
|
-
rspec-expectations (3.
|
|
57
|
+
rouge (4.2.0)
|
|
58
|
+
rspec (3.13.0)
|
|
59
|
+
rspec-core (~> 3.13.0)
|
|
60
|
+
rspec-expectations (~> 3.13.0)
|
|
61
|
+
rspec-mocks (~> 3.13.0)
|
|
62
|
+
rspec-core (3.13.0)
|
|
63
|
+
rspec-support (~> 3.13.0)
|
|
64
|
+
rspec-expectations (3.13.0)
|
|
62
65
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
63
|
-
rspec-support (~> 3.
|
|
64
|
-
rspec-mocks (3.
|
|
66
|
+
rspec-support (~> 3.13.0)
|
|
67
|
+
rspec-mocks (3.13.0)
|
|
65
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
|
-
rspec-support (~> 3.
|
|
67
|
-
rspec-support (3.
|
|
69
|
+
rspec-support (~> 3.13.0)
|
|
70
|
+
rspec-support (3.13.0)
|
|
68
71
|
strings (0.2.1)
|
|
69
72
|
strings-ansi (~> 0.2)
|
|
70
73
|
unicode-display_width (>= 1.5, < 3.0)
|
|
@@ -95,12 +98,9 @@ GEM
|
|
|
95
98
|
tty-cursor (~> 0.7)
|
|
96
99
|
tty-screen (~> 0.8)
|
|
97
100
|
wisper (~> 2.0)
|
|
98
|
-
tty-screen (0.8.
|
|
101
|
+
tty-screen (0.8.2)
|
|
99
102
|
tty-spinner (0.9.3)
|
|
100
103
|
tty-cursor (~> 0.7)
|
|
101
|
-
unf (0.1.4)
|
|
102
|
-
unf_ext
|
|
103
|
-
unf_ext (0.0.8.2)
|
|
104
104
|
unicode-display_width (2.5.0)
|
|
105
105
|
unicode_utils (1.4.0)
|
|
106
106
|
wisper (2.0.1)
|
data/README.md
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
**Change Log**
|
|
29
29
|
|
|
30
|
+
- [February 9, 2024] Minor update; default model changed to `gpt-3.5-turbo-0125`
|
|
30
31
|
- [November 10, 2023] Stability improvement; default model changed to `gpt-3.5-turbo`
|
|
31
32
|
- [October 07, 2023] Stability improvement; default model changed to `gpt-3.5-turbo-0613`
|
|
32
33
|
- [June 11, 2023] The repository renamed to `monadic-chat-cli`
|
|
@@ -304,13 +305,13 @@ Monadic Chat has two modes. The `normal` mode utilizes OpenAI's chat API to achi
|
|
|
304
305
|
|
|
305
306
|
### Normal Mode
|
|
306
307
|
|
|
307
|
-
The current default language model for `normal` mode is `gpt-3.5-turbo`.
|
|
308
|
+
The current default language model for `normal` mode is `gpt-3.5-turbo-0125`.
|
|
308
309
|
|
|
309
310
|
In the default configuration, the dialogue messages are reduced after ten turns by deleting the oldest ones (but not the messages that the `system` role has given as instructions).
|
|
310
311
|
|
|
311
312
|
### Research Mode
|
|
312
313
|
|
|
313
|
-
The current default language model for `research` mode is `gpt-
|
|
314
|
+
The current default language model for `research` mode is `gpt-4-turbo-preview`.
|
|
314
315
|
|
|
315
316
|
In `research` mode, the conversation between the user and the large-scale language model is accomplished with a mechanism that tracks the conversation history in a monadic structure. In the default configuration, the dialogue messages are reduced after ten turns by deleting the oldest ones (but not the messages that the `system` role has given as instructions).
|
|
316
317
|
|
data/lib/monadic_chat/open_ai.rb
CHANGED
|
@@ -24,6 +24,7 @@ module OpenAI
|
|
|
24
24
|
|
|
25
25
|
def self.model_to_method(model)
|
|
26
26
|
res = {
|
|
27
|
+
"gpt-3.5-turbo-0125" => "chat/completions",
|
|
27
28
|
"gpt-3.5-turbo-1106" => "chat/completions",
|
|
28
29
|
"gpt-3.5-turbo" => "chat/completions",
|
|
29
30
|
"gpt-3.5-turbo-16k" => "chat/completions",
|
|
@@ -72,16 +73,11 @@ module OpenAI
|
|
|
72
73
|
if query["stream"]
|
|
73
74
|
json = nil
|
|
74
75
|
buffer = ""
|
|
75
|
-
# break_flag = false
|
|
76
76
|
|
|
77
77
|
res.body.each do |chunk|
|
|
78
78
|
break if /\Rdata: [DONE]\R/ =~ chunk
|
|
79
79
|
|
|
80
|
-
# break if break_flag
|
|
81
|
-
|
|
82
80
|
buffer << chunk
|
|
83
|
-
# break_flag = true if /\Rdata: [DONE]\R/ =~ buffer
|
|
84
|
-
|
|
85
81
|
scanner = StringScanner.new(buffer)
|
|
86
82
|
pattern = /data: (\{.*?\})(?=\n|\z)/m
|
|
87
83
|
until scanner.eos?
|
|
@@ -92,16 +88,15 @@ module OpenAI
|
|
|
92
88
|
begin
|
|
93
89
|
res = JSON.parse(json_data)
|
|
94
90
|
choice = res.dig("choices", 0) || {}
|
|
91
|
+
|
|
95
92
|
fragment = choice.dig("delta", "content").to_s
|
|
93
|
+
next if !fragment || fragment == ""
|
|
96
94
|
|
|
97
95
|
block&.call fragment
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
json["choices"][0]["text"] ||= +""
|
|
103
|
-
json["choices"][0]["text"] << fragment
|
|
104
|
-
end
|
|
97
|
+
json ||= res
|
|
98
|
+
json["choices"][0]["text"] ||= +""
|
|
99
|
+
json["choices"][0]["text"] << fragment
|
|
105
100
|
|
|
106
101
|
if choice["finish_reason"] == "length" || choice["finish_reason"] == "stop"
|
|
107
102
|
finish = { "type" => "message", "content" => "DONE" }
|
data/lib/monadic_chat/version.rb
CHANGED
data/lib/monadic_chat.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: monadic-chat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- yohasebe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|