gpt4all 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 677356f50a80a8d91eb4e0e2146ac4f005896ba1e1250ace66dd57e862444623
4
- data.tar.gz: fdb9dcf280aa544f8b7e26c4a9da143ce2ea3bfae4a7a20f995db6258b921c31
3
+ metadata.gz: bcbc4d0a68ce0e29cae2ded264680ea57c279b0cb514545b199b6c03141b6af4
4
+ data.tar.gz: 9662b980b9c22ec94d252ac5793f48deba90739db2804757438f2a345632cff2
5
5
  SHA512:
6
- metadata.gz: cf7831d84c641dad48a6c8e6db0889af99a16cea58064f33fe7a6cf2bc331504ab1293d3c8636cdeb84685fbab7183d91bdb06c5b9ed1b7c681aa251e77dd4c3
7
- data.tar.gz: 27e532c867292cd131fa061d611497540984ab3ba69c633327b51709b04db33b440a8d834c2694c9a2ed01a0b098ab990260f3edeab59ad46a46599b15223749
6
+ metadata.gz: a6f1e2c6146a365aee6ec0df861113b6e9ea452781f19473429147d563c32a7d1897a55aeeab72dfc66d64e0e32a6cf0a0f9ddf70062a154ad84fbb6766fe14a
7
+ data.tar.gz: 13e4b5cd8aa2dbbf7d707d8e484c8ddebb3699aed13c761813085b9b55ae4e7d7145d48fb6a2549d66eb04f59eb5528a0caf5d579bacff04f2fd7bfec24b5e86
data/Gemfile CHANGED
@@ -15,8 +15,7 @@ gem 'brakeman'
15
15
  gem 'bundler-audit'
16
16
  gem 'byebug'
17
17
  gem 'dotenv'
18
- gem 'license_finder'
19
- gem 'overcommit'
18
+
20
19
  gem 'rubocop-performance'
21
20
  gem 'rubocop-sequel'
22
21
  gem 'rubocop-shopify'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gpt4all (0.0.3)
4
+ gpt4all (0.0.4)
5
5
  faraday (~> 2.7)
6
6
  os (~> 1.1)
7
7
  tty-progressbar (~> 0.18.2)
@@ -17,7 +17,6 @@ GEM
17
17
  bundler (>= 1.2.0, < 3)
18
18
  thor (~> 1.0)
19
19
  byebug (11.1.3)
20
- childprocess (4.1.0)
21
20
  crack (0.4.5)
22
21
  rexml
23
22
  diff-lcs (1.5.0)
@@ -27,20 +26,8 @@ GEM
27
26
  ruby2_keywords (>= 0.0.4)
28
27
  faraday-net_http (3.0.2)
29
28
  hashdiff (1.0.1)
30
- iniparse (1.5.0)
31
29
  json (2.6.3)
32
- license_finder (7.1.0)
33
- bundler
34
- rubyzip (>= 1, < 3)
35
- thor (~> 1.2)
36
- tomlrb (>= 1.3, < 2.1)
37
- with_env (= 1.1.0)
38
- xml-simple (~> 1.1.9)
39
30
  os (1.1.4)
40
- overcommit (0.60.0)
41
- childprocess (>= 0.6.3, < 5)
42
- iniparse (~> 1.4)
43
- rexml (~> 3.2)
44
31
  parallel (1.22.1)
45
32
  parser (3.2.2.0)
46
33
  ast (~> 2.4.1)
@@ -83,10 +70,8 @@ GEM
83
70
  rubocop (~> 1.44)
84
71
  ruby-progressbar (1.13.0)
85
72
  ruby2_keywords (0.0.5)
86
- rubyzip (2.3.2)
87
73
  strings-ansi (0.2.0)
88
74
  thor (1.2.1)
89
- tomlrb (2.0.3)
90
75
  tty-cursor (0.7.1)
91
76
  tty-progressbar (0.18.2)
92
77
  strings-ansi (~> 0.2)
@@ -99,9 +84,6 @@ GEM
99
84
  addressable (>= 2.8.0)
100
85
  crack (>= 0.3.2)
101
86
  hashdiff (>= 0.4.0, < 2.0.0)
102
- with_env (1.1.0)
103
- xml-simple (1.1.9)
104
- rexml
105
87
 
106
88
  PLATFORMS
107
89
  aarch64-linux
@@ -117,8 +99,6 @@ DEPENDENCIES
117
99
  byebug
118
100
  dotenv
119
101
  gpt4all!
120
- license_finder
121
- overcommit
122
102
  rake (~> 13.0)
123
103
  rspec (~> 3.0)
124
104
  rubocop (~> 1.21)
@@ -9,8 +9,9 @@ require 'tty-progressbar'
9
9
  module Gpt4all
10
10
  # rubocop:disable Metrics/ClassLength
11
11
  class ConversationalAI
12
- attr_accessor :bot, :model, :decoder_config, :executable_path, :model_path, :force_download, :test_mode
12
+ attr_accessor :model, :decoder_config, :executable_path, :model_path, :force_download, :test_mode
13
13
 
14
+ # https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin
14
15
  OSX_INTEL_URL = 'https://github.com/nomic-ai/gpt4all/blob/main/chat/gpt4all-lora-quantized-OSX-intel?raw=true'
15
16
  OSX_M1_URL = 'https://github.com/nomic-ai/gpt4all/blob/main/chat/gpt4all-lora-quantized-OSX-m1?raw=true'
16
17
  LINUX_URL = 'https://github.com/nomic-ai/gpt4all/blob/main/chat/gpt4all-lora-quantized-linux-x86?raw=true'
@@ -66,6 +67,30 @@ module Gpt4all
66
67
  @bot_pid = nil
67
68
  end
68
69
 
70
+ def restart_bot
71
+ stop_bot
72
+ start_bot
73
+ end
74
+
75
+ def prompt(input)
76
+ ensure_bot_is_ready
77
+
78
+ begin
79
+ bot.first.puts(input)
80
+ response = bot.last.gets.strip
81
+ rescue StandardError => e
82
+ puts "Error during prompt: #{e.message}"
83
+ restart_bot
84
+ response = prompt(input)
85
+ end
86
+
87
+ response
88
+ end
89
+
90
+ private
91
+
92
+ attr_reader :bot
93
+
69
94
  def download_executable
70
95
  FileUtils.mkdir_p(File.dirname(executable_path))
71
96
  download_file(determine_upstream_url, executable_path)
@@ -87,8 +112,9 @@ module Gpt4all
87
112
 
88
113
  def download_model
89
114
  model_url = "https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/#{model}.bin"
90
-
91
115
  download_file(model_url, model_path)
116
+ download_md5_file
117
+ verify_md5_signature
92
118
 
93
119
  puts "File downloaded successfully to #{model_path}"
94
120
  end
@@ -140,6 +166,23 @@ module Gpt4all
140
166
  end
141
167
  end
142
168
 
169
+ def download_md5_file
170
+ md5_url = "https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/#{model}.bin.md5"
171
+ md5_path = "#{model_path}.md5"
172
+ download_file(md5_url, md5_path)
173
+ end
174
+
175
+ def verify_md5_signature
176
+ md5_path = "#{model_path}.md5"
177
+ raise 'MD5 file not found.' unless File.exist?(md5_path)
178
+
179
+ expected_md5 = File.read(md5_path).strip
180
+ actual_md5 = Digest::MD5.file(model_path).hexdigest
181
+ raise 'MD5 signature mismatch.' unless expected_md5 == actual_md5
182
+
183
+ puts 'MD5 signature verified successfully.'
184
+ end
185
+
143
186
  def wait_for_bot_ready
144
187
  loop do
145
188
  output = bot.last.gets
@@ -147,29 +190,9 @@ module Gpt4all
147
190
  end
148
191
  end
149
192
 
150
- def prompt(input)
151
- ensure_bot_is_ready
152
-
153
- begin
154
- bot.first.puts(input)
155
- response = bot.last.gets.strip
156
- rescue StandardError => e
157
- puts "Error during prompt: #{e.message}"
158
- restart_bot
159
- response = prompt(input)
160
- end
161
-
162
- response
163
- end
164
-
165
193
  def ensure_bot_is_ready
166
194
  raise 'Bot is not initialized.' unless bot
167
195
  end
168
-
169
- def restart_bot
170
- stop_bot
171
- start_bot
172
- end
173
196
  end
174
197
  # rubocop:enable Metrics/ClassLength
175
198
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gpt4all
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpt4all
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaigouk Kim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-07 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -71,8 +71,6 @@ files:
71
71
  - lib/gpt4all.rb
72
72
  - lib/gpt4all/conversational_ai.rb
73
73
  - lib/gpt4all/version.rb
74
- - model.bin
75
- - sig/gpt4all.rbs
76
74
  homepage: https://github.com/jaigouk/gpt4all
77
75
  licenses:
78
76
  - MIT
@@ -97,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  - !ruby/object:Gem::Version
98
96
  version: '0'
99
97
  requirements: []
100
- rubygems_version: 3.2.33
98
+ rubygems_version: 3.4.10
101
99
  signing_key:
102
100
  specification_version: 4
103
101
  summary: gpt4all
data/model.bin DELETED
@@ -1 +0,0 @@
1
- This is a mock file content
data/sig/gpt4all.rbs DELETED
@@ -1,27 +0,0 @@
1
- module Gpt4all
2
- VERSION: String
3
-
4
- class ConversationalAI
5
- @bot: Process::Child | nil
6
- @model: String
7
- @decoder_config: Hash[String, untyped]
8
- @executable_path: String
9
- @model_path: String
10
-
11
- def initialize: (String? model, bool? force_download, Hash[String, untyped]? decoder_config) -> void
12
-
13
- def init: (?bool force_download) -> void
14
-
15
- def open: () -> void
16
-
17
- def close: () -> void
18
-
19
- private def download_executable: () -> void
20
-
21
- private def download_model: () -> void
22
-
23
- private def download_file: (String url, String destination) -> void
24
-
25
- def prompt: (String input) -> String
26
- end
27
- end