chatgpt2023 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d76a15a250b67bab6e676ed5c18131cde6310d9c5ace84921e8113c21b4c180f
4
- data.tar.gz: bbdce3b4c8ba915e55f3b440da3fc368d90ad6a0555ae1ebf8e6065e44061bd3
3
+ metadata.gz: 8f937d13ec5131003c4acf2b9c046cb56e4462bb72e89700cb56fb2c376c3846
4
+ data.tar.gz: e2252feb992e7c3538ae917d63abc6b4f4743e8faa328fff0ce36f1af221508e
5
5
  SHA512:
6
- metadata.gz: fb2c05d8493193771ae4480dfa340af843c4c73ae497cc03aa9504c5c9fbb5c30456df7c5c37db26f68bba3419ca41447d4e8436b7aab9b060bcce2160fd6254
7
- data.tar.gz: b2c4d4292b30a127935de35156cd48b50ae7c5890e2c5cbe0e6e5f37bf56641db73bb136ee6a2a3d88b8227aacc05f8041281347920d0da7a54d2b9f6a899171
6
+ metadata.gz: 88b1657db3ac774bfae4df8166a2aa26ef520af5194a7ba1718aea6612a2a75350de457b8dabb150bda4e149a4851648f45eecfdc1dd6276794fdb1358c760a5
7
+ data.tar.gz: dd610445a564e33fde61cdedda227a843d6410457f90b8a85b3255e627462fb51cae5a3767d56e6346f277466df97053fd3f41155fba06d7fbbd34d4e125144c
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/chatgpt2023.rb CHANGED
@@ -79,7 +79,16 @@ class ChatGpt2023
79
79
 
80
80
  def chats(s=nil, messages: [], temperature: 1, max_tokens: 3900, n: 1)
81
81
 
82
- messages << @assistant_recent if @assistant_recent
82
+ if @assistant_recent then
83
+
84
+ # We limit what gets passed back because there should enough
85
+ # information in the 1st 140 chars to infer the conversation context
86
+ #
87
+ @assistant_recent[:content].slice!(140..-1)
88
+ messages << @assistant_recent
89
+ max_tokens -= @assistant_recent[:content].split.length
90
+ end
91
+
83
92
  messages << {'role' => 'user', 'content' => s } if s
84
93
  r = go_chat(messages, temperature: temperature,
85
94
  max_tokens: max_tokens, n: n)
@@ -296,6 +305,15 @@ class CGRecorder < ChatGpt2023
296
305
 
297
306
  end
298
307
 
308
+ def chat(s, tags=nil, temperature: 1, max_tokens: 1000)
309
+
310
+ r = super(s, temperature: temperature, max_tokens: max_tokens)
311
+ puts 'CGRecorder inside chat: ' + r.inspect if @debug
312
+ log(s, r[:text].strip, tags) unless r[:error]
313
+
314
+ return r
315
+ end
316
+
299
317
  def code_completion(s, tags=nil, temperature: 1, max_tokens: 2000)
300
318
 
301
319
  r = super(s, temperature: temperature, max_tokens: max_tokens)
@@ -312,8 +330,8 @@ class CGRecorder < ChatGpt2023
312
330
  log(s, r[:text].strip, tags) unless r[:error]
313
331
 
314
332
  return r
315
-
316
333
  end
334
+
317
335
 
318
336
  alias complete completion
319
337
  alias ask completion
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatgpt2023
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -36,7 +36,7 @@ cert_chain:
36
36
  6FQD1/GISew7VvxUJdptXeuVNIsdNKxvL3RpfLCuFsi1WXyJ4k3odRMTmS0kAfTy
37
37
  J4sZZW9RNfabTMQQY7DIs3tUAn6i+O0r9lo=
38
38
  -----END CERTIFICATE-----
39
- date: 2023-03-05 00:00:00.000000000 Z
39
+ date: 2023-03-13 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: down
metadata.gz.sig CHANGED
Binary file