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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17f06505d496fef06c186773df25fa37d7a2e465fac06682f51a300933e286d5
4
- data.tar.gz: caefca3868f25c1cd15e6bf441ae3e595a2be4b5fb7574431c1a57284ca00327
3
+ metadata.gz: cf8ec2d335097ccfe7a540e2d2fa7253d181db9a255517fd32118707c3bbee0d
4
+ data.tar.gz: f6d150a528511f20b0523a1c1e30268c526386ed3d309b3faa6ff524cb2b7659
5
5
  SHA512:
6
- metadata.gz: '09d533d49ac00fd23230ae8ea81f2c189d81b285738142e323b07bb5ea9cbac3cd91ae8f41daa56c37ea1c5297d99573e8dac2c411ec5add299644e8d888ea1e'
7
- data.tar.gz: 15751ae8ef5e041b5ac8638626bac0e938fe989a5647af4c59c8a9cdc803e0796889f4353adf0a5fefe0af0430187f82ca21ccdd9dcd0a53c88a3edd8829c45d
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
 
@@ -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 :async_http, clients: Async::HTTP::Faraday::PersistentClients
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
@@ -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 = Application.llm_client.chat(
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
- ).dig("choices", 0, "message", "content")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kaba
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.2"
5
5
  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.3.0
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-15 00:00:00.000000000 Z
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