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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0add8ecf9ac4613decb084b678c044809896db95136b59e24602ae47a426d448
4
- data.tar.gz: 2dda3c5fa0152b4928c4a2fadc11b18ed429cc724e87c5b38c794083cb731c69
3
+ metadata.gz: 986fbab4a45443b0ffc9676cbe6ea2857a7eaec7ba74294561c4d8abe8bf8869
4
+ data.tar.gz: e5a2254a5f2dc1778083df00141c59654749e2538eb695384c3528c49a8820dd
5
5
  SHA512:
6
- metadata.gz: 622be2e55740919481236e525f2c2045f9f633eccfa36363a55d959c8d25cd859cfc349e6668df429571052d9501077f8068c35e1a72bac25ced650188c3407e
7
- data.tar.gz: 56c1a740604cb48c6bfb14f5c93854597fa53922c2befd03e58cf192d29e2b2b1ac87d9480255ae6c6ef175d2652299b67b0cba8cb1e0deccf405adce9efa22b
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
- if ARGV[0] == 'test'
11
- # 运行测试程序
12
- load DatasetSource.testfile
13
- elsif ARGV[0] == 'version'
14
- # 显示版本号
15
- puts Kaba::VERSION
16
- else
17
- # 运行 DPodfile 文件,DPodfile 是一个 Ruby 文件
18
- load DatasetSource.podfile
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kaba
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/kaba.rb CHANGED
@@ -19,6 +19,7 @@ require_relative "kaba/prompt"
19
19
  require_relative "kaba/validate"
20
20
  require_relative "kaba/judge"
21
21
  require_relative "kaba/test_runner"
22
+ require_relative "kaba/boot"
22
23
 
23
24
  module Kaba
24
25
  class Error < StandardError; end
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.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-18 00:00:00.000000000 Z
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