kaba 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kaba.gemspec +1 -0
- data/lib/kaba/application.rb +3 -2
- data/lib/kaba/test_runner.rb +7 -4
- data/lib/kaba/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8ec2d335097ccfe7a540e2d2fa7253d181db9a255517fd32118707c3bbee0d
|
4
|
+
data.tar.gz: f6d150a528511f20b0523a1c1e30268c526386ed3d309b3faa6ff524cb2b7659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2fa2925775abd5bc7e04e0ff58ed3066f321dbe6c796f40eb66048945f8b3860ab8ee721b2aa4e612fac7b79f3dc57880c7b35e2e4e0ba29cc01de72db894b7
|
7
|
+
data.tar.gz: ba270bbcb84f5e89ad5154e1a789515c5200cf92dacaab1252f2bc60440e93d1c1fe999eaad98d9c2eb29bf73b720bb27608f22fff62f1d3d4eec52c9b5aefc1
|
data/kaba.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "用来做数据集的工具"
|
13
13
|
spec.homepage = "https://github.com/mjason/kaba.git"
|
14
14
|
spec.required_ruby_version = ">= 3.3.0"
|
15
|
+
spec.license = "MIT"
|
15
16
|
|
16
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
17
18
|
|
data/lib/kaba/application.rb
CHANGED
@@ -10,11 +10,12 @@ class Application
|
|
10
10
|
|
11
11
|
def llm_client
|
12
12
|
@llm_client ||= OpenAI::Client.new(
|
13
|
+
log_errors: true,
|
13
14
|
access_token: env!("LISA_ACCESS_TOKEN"),
|
14
15
|
request_timeout: ENV.fetch("LISA_LLM_REQUEST_TIMEOUT", 120).to_i,
|
15
16
|
uri_base: ENV.fetch("LISA_LLM_URI_BASE", "https://api.listenai.com")
|
16
17
|
) do |faraday|
|
17
|
-
faraday.adapter
|
18
|
+
faraday.adapter Faraday.default_adapter, clients: Async::HTTP::Faraday::PersistentClients
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
@@ -28,4 +29,4 @@ class Application
|
|
28
29
|
ENV[name] or raise "missing environment variable: #{name}"
|
29
30
|
end
|
30
31
|
end
|
31
|
-
end
|
32
|
+
end
|
data/lib/kaba/test_runner.rb
CHANGED
@@ -46,14 +46,17 @@ class TestRunner
|
|
46
46
|
#{JSON.pretty_generate(JSON.parse(File.read(row.target_path)))}
|
47
47
|
```
|
48
48
|
Markdown
|
49
|
-
output =
|
49
|
+
output = ""
|
50
|
+
Application.llm_client.chat(
|
50
51
|
parameters: {
|
51
52
|
model: model,
|
52
53
|
messages: [ { role: 'user', content: input } ],
|
53
54
|
temperature: temperature,
|
55
|
+
stream: proc do |chunk, _bytesize|
|
56
|
+
output += chunk.dig("choices", 0, "delta", "content")
|
57
|
+
end
|
54
58
|
}
|
55
|
-
)
|
56
|
-
|
59
|
+
)
|
57
60
|
|
58
61
|
output_json = JSON.parse_llm_response output
|
59
62
|
|
@@ -106,4 +109,4 @@ class TestRunner
|
|
106
109
|
end
|
107
110
|
end
|
108
111
|
|
109
|
-
end
|
112
|
+
end
|
data/lib/kaba/version.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.3.
|
4
|
+
version: 0.3.2
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -153,7 +153,8 @@ files:
|
|
153
153
|
- lib/kaba/version.rb
|
154
154
|
- sig/kaba.rbs
|
155
155
|
homepage: https://github.com/mjason/kaba.git
|
156
|
-
licenses:
|
156
|
+
licenses:
|
157
|
+
- MIT
|
157
158
|
metadata:
|
158
159
|
homepage_uri: https://github.com/mjason/kaba.git
|
159
160
|
source_code_uri: https://github.com/mjason/kaba.git
|