kaba 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/kaba +38 -10
- data/kaba.gemspec +1 -0
- data/lib/kaba/boot.rb +32 -0
- data/lib/kaba/version.rb +1 -1
- data/lib/kaba.rb +1 -0
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986fbab4a45443b0ffc9676cbe6ea2857a7eaec7ba74294561c4d8abe8bf8869
|
4
|
+
data.tar.gz: e5a2254a5f2dc1778083df00141c59654749e2538eb695384c3528c49a8820dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42b2a10981e7133b1b34b5a9e38ea5c12a0b7965ce4b12b689a8840b2d45b672ba1b04d6a6462b2d4f93ce8fa2d34fbd77769ee09725801f217f3f25145a5a8c
|
7
|
+
data.tar.gz: ba4cfed522723fca973d6c265eeb5e9d97edad4326bbbd36086cf385bae31ed8d37b7607e368dd40129311d37f43711e5749fd88cbd79e29e3c0f99a74592b97
|
data/exe/kaba
CHANGED
@@ -6,14 +6,42 @@ require 'dotenv'
|
|
6
6
|
Dotenv.load
|
7
7
|
|
8
8
|
require "kaba"
|
9
|
+
require 'thor'
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
11
|
+
class KabaCommand < Thor
|
12
|
+
desc "test", "Run the test program"
|
13
|
+
def test
|
14
|
+
load DatasetSource.testfile
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "version", "Show the version"
|
18
|
+
def version
|
19
|
+
puts Kaba::VERSION
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "exec FILE", "Run a specified Ruby file"
|
23
|
+
def exec(file)
|
24
|
+
load file
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "create", "Run the DPodfile (default behavior)"
|
28
|
+
def create
|
29
|
+
load DatasetSource.podfile
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "validate", "Validate the environment"
|
33
|
+
def validate
|
34
|
+
Boot.validate
|
35
|
+
end
|
36
|
+
|
37
|
+
# 默认行为处理(兼容现有行为)
|
38
|
+
def self.start(args = ARGV, config = {})
|
39
|
+
if args.empty?
|
40
|
+
new.create
|
41
|
+
else
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
KabaCommand.start
|
data/kaba.gemspec
CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_dependency "dotenv", "~> 3.1"
|
41
41
|
spec.add_dependency "ruby-openai", "~> 7.3"
|
42
42
|
spec.add_dependency "json-repair", "~> 0.2.0"
|
43
|
+
spec.add_dependency "thor", '~> 1.3', '>= 1.3.2'
|
43
44
|
|
44
45
|
# For more information and examples about making a new gem, check out our
|
45
46
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/lib/kaba/boot.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Boot
|
2
|
+
module_function
|
3
|
+
def init
|
4
|
+
# 判断 .env 文件是否存在, 不存在则创建
|
5
|
+
unless File.exist?(".env")
|
6
|
+
File.open(".env", "w") do |f|
|
7
|
+
f.write("LISA_ACCESS_TOKEN=<Lisa access token, visit: https://platform.listenai.com/>\n")
|
8
|
+
f.write("JUDGE_ACCCESS_TOKEN=<Judge access token, visit: https://platform.listenai.com/>\n")
|
9
|
+
|
10
|
+
f.write("; if you are using a different typechat endpoint, please fill in the following line\n")
|
11
|
+
f.write("; LISA_TYPECHAT_ENDPOINT=https://lisa-typechat.listenai.com\n")
|
12
|
+
|
13
|
+
f.write("; if you are using a different LLM endpoint, please fill in the following line\n")
|
14
|
+
f.write("; LISA_LLM_URI_BASE=https://api.listenai.com\n")
|
15
|
+
|
16
|
+
f.write("; if you are using a different JUDGE LLM endpoint, please fill in the following line\n")
|
17
|
+
f.write("; JUDGE_LLM_URI_BASE=https://api.listenai.com\n")
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "Created .env file, please fill in the necessary information."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate
|
25
|
+
puts "Validating..."
|
26
|
+
Application.env!('LISA_ACCESS_TOKEN')
|
27
|
+
Application.env!('JUDGE_ACCCESS_TOKEN')
|
28
|
+
puts "Validation passed."
|
29
|
+
rescue => e
|
30
|
+
puts "Validation failed: #{e.message}"
|
31
|
+
end
|
32
|
+
end
|
data/lib/kaba/version.rb
CHANGED
data/lib/kaba.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MJ
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -122,6 +122,26 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.2.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.3'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.3.2
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '1.3'
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 1.3.2
|
125
145
|
description: 用来做数据集的工具
|
126
146
|
email:
|
127
147
|
- tywf91@gmail.com
|
@@ -140,6 +160,7 @@ files:
|
|
140
160
|
- lib/kaba/_DPodfile_
|
141
161
|
- lib/kaba/_DTestfile_
|
142
162
|
- lib/kaba/application.rb
|
163
|
+
- lib/kaba/boot.rb
|
143
164
|
- lib/kaba/dataset.rb
|
144
165
|
- lib/kaba/dataset_source.rb
|
145
166
|
- lib/kaba/json.rb
|