n2b 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/n2b/llm/claude.rb +1 -1
- data/lib/n2b/llm/open_ai.rb +1 -2
- data/lib/n2b/version.rb +1 -1
- data/lib/n2b.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58cae30259d2c0399fe26b0170d1c59eb9e9ed89ba3831668e6931571d4407e
|
4
|
+
data.tar.gz: f8f05b3fa22da7257ba7bbca704537d21f4e7ec80f7304225935e32cd1596d50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2a96d2da2390481dea2cf5044d64164e58d4a168e5f5367df4162ebfa8867c01c078af42c186bfad8518546b602cce65029b07c7251534530847beeed0febef
|
7
|
+
data.tar.gz: 4eb2e07f2021e19e3beea4dcff79c3e226eb03198ba574a54f62e13df248a625bcd51764e23b0aa956e11215d726705be2bc877defb9d302eb5cde6452f4b82d
|
data/lib/n2b/llm/claude.rb
CHANGED
@@ -38,7 +38,7 @@ module N2M
|
|
38
38
|
answer = JSON.parse(response.body)['content'].first['text']
|
39
39
|
begin
|
40
40
|
# removee everything before the first { and after the last }
|
41
|
-
answer = answer.sub(/.*\{(.*)\}.*/m, '{\1}')
|
41
|
+
answer = answer.sub(/.*\{(.*)\}.*/m, '{\1}') unless answer.start_with?('{')
|
42
42
|
answer = JSON.parse(answer)
|
43
43
|
rescue JSON::ParserError
|
44
44
|
answer = { 'commands' => answer.split("\n"), explanation: answer}
|
data/lib/n2b/llm/open_ai.rb
CHANGED
@@ -37,11 +37,10 @@ module N2M
|
|
37
37
|
puts response.body
|
38
38
|
exit 1
|
39
39
|
end
|
40
|
-
puts JSON.parse(response.body)
|
41
40
|
answer = JSON.parse(response.body)['choices'].first['message']['content']
|
42
41
|
begin
|
43
42
|
# remove everything before the first { and after the last }
|
44
|
-
answer = answer.sub(/.*\{(.*)\}.*/m, '{\1}')
|
43
|
+
answer = answer.sub(/.*\{(.*)\}.*/m, '{\1}') unless answer.start_with?('{')
|
45
44
|
answer = JSON.parse(answer)
|
46
45
|
rescue JSON::ParserError
|
47
46
|
answer = { 'commands' => answer.split("\n"), explanation: answer }
|
data/lib/n2b/version.rb
CHANGED
data/lib/n2b.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: n2b
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Nothegger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '13.0'
|
55
55
|
description: A tool to convert natural language instructions to bash commands using
|
56
|
-
Claude API
|
56
|
+
Claude API or OpenAI's GPT.
|
57
57
|
email:
|
58
58
|
- stefan@kaproblem.com
|
59
59
|
executables:
|