rbs_goose 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +41 -37
- data/README-EN-US.md +18 -11
- data/README.md +15 -8
- data/Rakefile +2 -7
- data/lib/rbs_goose/configuration.rb +2 -2
- data/lib/rbs_goose/examples/rbs_samples/lib/person.rb +4 -0
- data/lib/rbs_goose/examples/rbs_samples/refined/sig/person.rbs +2 -0
- data/lib/rbs_goose/examples/rbs_samples/sig/person.rbs +2 -0
- data/lib/rbs_goose/version.rb +1 -1
- metadata +18 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfba03266529804e3cd1123057d193e3362495c21686f596d6e88acd48da4862
|
4
|
+
data.tar.gz: b118cb15e016f8a678410df2b36c7e4079fecceebb512491935320197e193e32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba1f1b303559ea88caa1899b66875139add68526b9d4236c56b8562fd32fac460711ed5e51354ef1df7b3ac5fb962a34868cafaa4d603d35bcfd753deb3bc48
|
7
|
+
data.tar.gz: 2267ed274906716dfa4e7234ac7c1dfe9d633d8f0308b9311d6545d280085a82392a6fe2154de2763298b66a2d6f89963cdeeade666c2590c58aea46e39711a2
|
data/Gemfile
CHANGED
@@ -14,7 +14,7 @@ gem 'rubocop', '~> 1.21'
|
|
14
14
|
gem 'rubocop-factory_bot', '~> 2.25.1'
|
15
15
|
gem 'rubocop-rake', '~> 0.6.0'
|
16
16
|
gem 'rubocop-rspec', '~> 2.22'
|
17
|
-
gem 'ruby-openai', '~> 6.
|
17
|
+
gem 'ruby-openai', '~> 6.3.0'
|
18
18
|
gem 'steep', '~> 1.6.0'
|
19
19
|
gem 'vcr', '~> 6.2.0'
|
20
|
-
gem 'webmock', '~> 3.
|
20
|
+
gem 'webmock', '~> 3.19.0'
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbs_goose (0.1.
|
5
|
-
langchainrb (
|
6
|
-
ruby-openai (
|
4
|
+
rbs_goose (0.1.1)
|
5
|
+
langchainrb (>= 0.8.2, < 1.0.0)
|
6
|
+
ruby-openai (>= 6.1.0, < 7.0.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
abbrev (0.1.2)
|
12
|
-
activesupport (7.1.
|
12
|
+
activesupport (7.1.3)
|
13
13
|
base64
|
14
14
|
bigdecimal
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -19,37 +19,38 @@ GEM
|
|
19
19
|
minitest (>= 5.1)
|
20
20
|
mutex_m
|
21
21
|
tzinfo (~> 2.0)
|
22
|
-
addressable (2.8.
|
22
|
+
addressable (2.8.6)
|
23
23
|
public_suffix (>= 2.0.2, < 6.0)
|
24
24
|
ast (2.4.2)
|
25
25
|
baran (0.1.10)
|
26
26
|
base64 (0.2.0)
|
27
|
-
bigdecimal (3.1.
|
27
|
+
bigdecimal (3.1.6)
|
28
28
|
colorize (0.8.1)
|
29
|
-
concurrent-ruby (1.2.
|
29
|
+
concurrent-ruby (1.2.3)
|
30
30
|
connection_pool (2.4.1)
|
31
|
-
crack (0.4.
|
31
|
+
crack (0.4.6)
|
32
|
+
bigdecimal
|
32
33
|
rexml
|
33
34
|
csv (3.2.8)
|
34
35
|
diff-lcs (1.5.0)
|
35
36
|
dotenv (2.8.1)
|
36
37
|
drb (2.2.0)
|
37
38
|
ruby2_keywords
|
38
|
-
event_stream_parser (0.
|
39
|
-
factory_bot (6.4.
|
39
|
+
event_stream_parser (1.0.0)
|
40
|
+
factory_bot (6.4.6)
|
40
41
|
activesupport (>= 5.0.0)
|
41
|
-
faraday (2.
|
42
|
-
faraday-net_http (>= 2.0, < 3.
|
43
|
-
ruby2_keywords (>= 0.0.4)
|
42
|
+
faraday (2.9.0)
|
43
|
+
faraday-net_http (>= 2.0, < 3.2)
|
44
44
|
faraday-multipart (1.0.4)
|
45
45
|
multipart-post (~> 2)
|
46
|
-
faraday-net_http (3.0
|
46
|
+
faraday-net_http (3.1.0)
|
47
|
+
net-http
|
47
48
|
ffi (1.16.3)
|
48
49
|
fileutils (1.7.2)
|
49
|
-
hashdiff (1.0
|
50
|
+
hashdiff (1.1.0)
|
50
51
|
i18n (1.14.1)
|
51
52
|
concurrent-ruby (~> 1.0)
|
52
|
-
json (2.
|
53
|
+
json (2.7.1)
|
53
54
|
json-schema (4.0.0)
|
54
55
|
addressable (>= 2.8)
|
55
56
|
langchainrb (0.8.2)
|
@@ -67,29 +68,31 @@ GEM
|
|
67
68
|
rb-inotify (~> 0.9, >= 0.9.10)
|
68
69
|
logger (1.6.0)
|
69
70
|
matrix (0.4.2)
|
70
|
-
minitest (5.21.
|
71
|
+
minitest (5.21.2)
|
71
72
|
multipart-post (2.3.0)
|
72
73
|
mutex_m (0.2.0)
|
74
|
+
net-http (0.4.1)
|
75
|
+
uri
|
73
76
|
orthoses (1.13.0)
|
74
77
|
rbs (~> 3.0)
|
75
|
-
parallel (1.
|
76
|
-
parser (3.
|
78
|
+
parallel (1.24.0)
|
79
|
+
parser (3.3.0.5)
|
77
80
|
ast (~> 2.4.1)
|
78
81
|
racc
|
79
82
|
pragmatic_segmenter (0.3.23)
|
80
83
|
unicode
|
81
|
-
public_suffix (5.0.
|
82
|
-
racc (1.7.
|
84
|
+
public_suffix (5.0.4)
|
85
|
+
racc (1.7.3)
|
83
86
|
rainbow (3.1.1)
|
84
|
-
rake (13.0
|
87
|
+
rake (13.1.0)
|
85
88
|
rb-fsevent (0.11.2)
|
86
89
|
rb-inotify (0.10.1)
|
87
90
|
ffi (~> 1.0)
|
88
91
|
rb_sys (0.9.86)
|
89
92
|
rbs (3.4.1)
|
90
93
|
abbrev
|
91
|
-
regexp_parser (2.
|
92
|
-
rexml (3.2.
|
94
|
+
regexp_parser (2.9.0)
|
95
|
+
rexml (3.2.6)
|
93
96
|
rspec (3.12.0)
|
94
97
|
rspec-core (~> 3.12.0)
|
95
98
|
rspec-expectations (~> 3.12.0)
|
@@ -103,31 +106,31 @@ GEM
|
|
103
106
|
diff-lcs (>= 1.2.0, < 2.0)
|
104
107
|
rspec-support (~> 3.12.0)
|
105
108
|
rspec-support (3.12.1)
|
106
|
-
rubocop (1.
|
109
|
+
rubocop (1.60.2)
|
107
110
|
json (~> 2.3)
|
108
111
|
language_server-protocol (>= 3.17.0)
|
109
112
|
parallel (~> 1.10)
|
110
|
-
parser (>= 3.
|
113
|
+
parser (>= 3.3.0.2)
|
111
114
|
rainbow (>= 2.2.2, < 4.0)
|
112
115
|
regexp_parser (>= 1.8, < 3.0)
|
113
116
|
rexml (>= 3.2.5, < 4.0)
|
114
|
-
rubocop-ast (>= 1.
|
117
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
115
118
|
ruby-progressbar (~> 1.7)
|
116
119
|
unicode-display_width (>= 2.4.0, < 3.0)
|
117
|
-
rubocop-ast (1.
|
120
|
+
rubocop-ast (1.30.0)
|
118
121
|
parser (>= 3.2.1.0)
|
119
|
-
rubocop-capybara (2.
|
122
|
+
rubocop-capybara (2.20.0)
|
120
123
|
rubocop (~> 1.41)
|
121
124
|
rubocop-factory_bot (2.25.1)
|
122
125
|
rubocop (~> 1.41)
|
123
126
|
rubocop-rake (0.6.0)
|
124
127
|
rubocop (~> 1.0)
|
125
|
-
rubocop-rspec (2.
|
126
|
-
rubocop (~> 1.
|
128
|
+
rubocop-rspec (2.26.1)
|
129
|
+
rubocop (~> 1.40)
|
127
130
|
rubocop-capybara (~> 2.17)
|
128
131
|
rubocop-factory_bot (~> 2.22)
|
129
|
-
ruby-openai (6.1
|
130
|
-
event_stream_parser (>= 0.3.0, <
|
132
|
+
ruby-openai (6.3.1)
|
133
|
+
event_stream_parser (>= 0.3.0, < 2.0.0)
|
131
134
|
faraday (>= 1)
|
132
135
|
faraday-multipart (>= 1)
|
133
136
|
ruby-progressbar (1.13.0)
|
@@ -157,9 +160,10 @@ GEM
|
|
157
160
|
tzinfo (2.0.6)
|
158
161
|
concurrent-ruby (~> 1.0)
|
159
162
|
unicode (0.4.4.4)
|
160
|
-
unicode-display_width (2.
|
163
|
+
unicode-display_width (2.5.0)
|
164
|
+
uri (0.13.0)
|
161
165
|
vcr (6.2.0)
|
162
|
-
webmock (3.
|
166
|
+
webmock (3.19.1)
|
163
167
|
addressable (>= 2.8.0)
|
164
168
|
crack (>= 0.3.2)
|
165
169
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -181,10 +185,10 @@ DEPENDENCIES
|
|
181
185
|
rubocop-factory_bot (~> 2.25.1)
|
182
186
|
rubocop-rake (~> 0.6.0)
|
183
187
|
rubocop-rspec (~> 2.22)
|
184
|
-
ruby-openai (~> 6.
|
188
|
+
ruby-openai (~> 6.3.0)
|
185
189
|
steep (~> 1.6.0)
|
186
190
|
vcr (~> 6.2.0)
|
187
|
-
webmock (~> 3.
|
191
|
+
webmock (~> 3.19.0)
|
188
192
|
|
189
193
|
BUNDLED WITH
|
190
194
|
2.4.10
|
data/README-EN-US.md
CHANGED
@@ -5,40 +5,47 @@
|
|
5
5
|
[![en-US README](https://img.shields.io/badge/Multilingual_README-en--US-blue.svg)](/README-EN-US.md)
|
6
6
|
[![en-JP README](https://img.shields.io/badge/Multilingual_README-ja--JP-orangered.svg)](/README.md)
|
7
7
|
|
8
|
-
[![Ruby](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml/badge.svg)](https://github.com/kokuyouwind/rbs_goose/
|
8
|
+
[![Ruby](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml/badge.svg)](https://github.com/kokuyouwind/rbs_goose/actions/workflows/main.yml)
|
9
9
|
|
10
10
|
RBS Goose is a tool that uses ChatGPT and other large language models to infer the RBS signature of Ruby code.
|
11
11
|
|
12
|
-
> [!CAUTION]
|
12
|
+
> [!CAUTION]
|
13
13
|
> Currently undergoing technical validation, so you may get little or no output of the appropriate types.
|
14
14
|
> Also, the tool uses ChatGPT API and other tools to infer RBS signatures, so depending on the size of your code, the usage fee may be expensive.
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
18
18
|
```bash
|
19
|
-
$ gem install
|
19
|
+
$ gem install rbs_goose
|
20
|
+
## Depending on the LangChain LLM you are using, install the corresponding gem
|
21
|
+
$ gem install ruby-openai
|
20
22
|
```
|
21
23
|
|
22
24
|
If you use `bundler`, add the following to your `Gemfile` instead.
|
23
25
|
|
24
26
|
```ruby
|
25
|
-
gem '
|
27
|
+
gem 'rbs_goose'.
|
28
|
+
# Depending on your LangChain LLM, install the corresponding gem
|
29
|
+
gem 'ruby-openai'
|
26
30
|
```
|
27
31
|
|
28
32
|
## Usage
|
29
33
|
|
30
|
-
Currently,
|
34
|
+
Currently, command line tools are not yet available, so please call `RbsGoose.run` directly from `Rakefile` or other sources.
|
31
35
|
|
32
36
|
If you use [OpenAI API](https://openai.com/blog/openai-api), do the following.
|
33
37
|
|
34
38
|
```ruby
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
require 'rbs_goose'
|
40
|
+
require 'openai'
|
41
|
+
|
42
|
+
desc 'refine RBS files in sig directory' ```ruby require 'rbs_goose' require 'openai'
|
43
|
+
task :refine do
|
44
|
+
RbsGoose.configure do |c|
|
45
|
+
c.use_open_ai(ENV.fetch('OPENAI_ACCESS_TOKEN'))
|
41
46
|
end
|
47
|
+
RbsGoose.run
|
48
|
+
end
|
42
49
|
```
|
43
50
|
|
44
51
|
Running this task will reference the Ruby code under `lib` and the RBS signature under `sig` and override the guessed signature.
|
data/README.md
CHANGED
@@ -16,13 +16,17 @@ RBS Goose は ChatGPT などの大規模言語モデルを利用して、 Ruby
|
|
16
16
|
## Installation
|
17
17
|
|
18
18
|
```bash
|
19
|
-
$ gem install
|
19
|
+
$ gem install rbs_goose
|
20
|
+
# 利用する LangChain LLM に応じて、対応する gem を合わせてインストールします
|
21
|
+
$ gem install ruby-openai
|
20
22
|
```
|
21
23
|
|
22
24
|
`bundler` を利用する場合は、代わりに以下を `Gemfile` に追加してください。
|
23
25
|
|
24
26
|
```ruby
|
25
|
-
gem '
|
27
|
+
gem 'rbs_goose'
|
28
|
+
# 利用する LangChain LLM に応じて、対応する gem を合わせてインストールします
|
29
|
+
gem 'ruby-openai'
|
26
30
|
```
|
27
31
|
|
28
32
|
## Usage
|
@@ -32,13 +36,16 @@ gem 'rbs-goose'
|
|
32
36
|
[OpenAI API](https://openai.com/blog/openai-api) を利用する場合は以下のようにします。
|
33
37
|
|
34
38
|
```ruby
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
require 'rbs_goose'
|
40
|
+
require 'openai'
|
41
|
+
|
42
|
+
desc 'refine RBS files in sig directory'
|
43
|
+
task :refine do
|
44
|
+
RbsGoose.configure do |c|
|
45
|
+
c.use_open_ai(ENV.fetch('OPENAI_ACCESS_TOKEN'))
|
41
46
|
end
|
47
|
+
RbsGoose.run
|
48
|
+
end
|
42
49
|
```
|
43
50
|
|
44
51
|
このタスクを実行すると、 `lib` 以下の Ruby コードと `sig` 以下の RBS シグニチャを参照し、推測したシグニチャを上書きします。
|
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ task :'spec:record' do
|
|
24
24
|
Rake::Task['spec'].invoke
|
25
25
|
end
|
26
26
|
|
27
|
-
namespace :sig do
|
27
|
+
namespace :sig do
|
28
28
|
desc 'build RBS prototypes to sig directory'
|
29
29
|
task :prototype do
|
30
30
|
require 'orthoses'
|
@@ -49,12 +49,7 @@ namespace :sig do # rubocop:disable Metrics/BlockLength
|
|
49
49
|
require_relative 'lib/rbs_goose'
|
50
50
|
|
51
51
|
RbsGoose.configure do |c|
|
52
|
-
c.use_open_ai(
|
53
|
-
ENV.fetch('OPENAI_ACCESS_TOKEN'),
|
54
|
-
default_options: {
|
55
|
-
completion_model_name: 'gpt-3.5-turbo-1106'
|
56
|
-
}
|
57
|
-
)
|
52
|
+
c.use_open_ai(ENV.fetch('OPENAI_ACCESS_TOKEN'))
|
58
53
|
end
|
59
54
|
RbsGoose.run
|
60
55
|
end
|
@@ -18,8 +18,8 @@ module RbsGoose
|
|
18
18
|
@llm = ::Langchain::LLM::OpenAI.new(
|
19
19
|
api_key: open_ai_access_token,
|
20
20
|
default_options: {
|
21
|
-
completion_model_name: 'gpt-3.5-turbo-
|
22
|
-
chat_completion_model_name: 'gpt-3.5-turbo-
|
21
|
+
completion_model_name: 'gpt-3.5-turbo-1106',
|
22
|
+
chat_completion_model_name: 'gpt-3.5-turbo-1106'
|
23
23
|
}.merge(default_options)
|
24
24
|
)
|
25
25
|
end
|
data/lib/rbs_goose/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_goose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kokuyouwind
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: langchainrb
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.2
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.8.2
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: ruby-openai
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: 6.1.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 7.0.0
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: 6.1.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 7.0.0
|
41
53
|
description: RBS type inferrer with LLM
|
42
54
|
email:
|
43
55
|
- kokuyouwind@gmail.com
|