gpt-function 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bba9981ceaa4edd441b41d6fe05ddf9f6a7a8545e66853fb7d863e600fd2c91
4
- data.tar.gz: c5c729ddf3db4c76ba9d44edc6de991c68088ff054cc1e04a9d69ac95e368190
3
+ metadata.gz: 6c4411299ea4a2b86fc42ba1d11fb73d803b346a73de2245298e5699024de470
4
+ data.tar.gz: 9c40d365a494bd517487ef2aab583dc358b6ad466d8924111f8c556ac0cb9bc5
5
5
  SHA512:
6
- metadata.gz: 72266ef62eea0e2807de3fc3ddd1c7228b7e9115ca8ae3cc05e35b4526ff23afcb63e8b9f938828f3514a65ad1844d39f6421cd2569572a5a49c8c39e1b72215
7
- data.tar.gz: b001c0c07bd574348abb06fbf68394dc42b830d7ed9be58622827fcd0518dcaa05cafc4fdee9837d5a49a4968a63205680cc01ad166b2850dfa94bf8b43befc4
6
+ metadata.gz: 416d168b50e81d1ff088d17512d00a066179a3a1a480144e710e4ce4766c6b6d646d4937ddd916bf679ed1e673ffcb1d5250b2e74bfd24bb3742d78e8705cd6a
7
+ data.tar.gz: fb618cff5345ce48e0858d0bec571038a1663b714577271a411512141c341126bf357989e29c4c9d1c47f0e58db489992bfbdf8e10c8dea18e2efd998f7401f9
data/lib/gpt-function.rb CHANGED
@@ -53,8 +53,10 @@ class GptFunction
53
53
  response = send_request(input)
54
54
  body = response.body.force_encoding("UTF-8")
55
55
  json = JSON.parse(body)
56
+
56
57
  # 處理可能的錯誤回應
57
- raise StandardError, json.dig("error", "message") if json.dig("error", "code")
58
+ error_message = json.dig("error", "message")
59
+ raise StandardError, error_message unless error_message.nil?
58
60
 
59
61
  # 處理正常的回應
60
62
  JSON.parse(json.dig("choices", 0, "message", "content"))["output"]
@@ -296,7 +296,7 @@ class GptFunction
296
296
  yield batch
297
297
 
298
298
  # 如果 batch 還未處理完成,將批次請求重新加入 Storage
299
- if batch.is_processed && auto_delete
299
+ if batch.is_processed && batch.auto_delete
300
300
  batch&.input_file&.delete rescue nil
301
301
  batch&.output_file&.delete rescue nil
302
302
  batch&.error_file&.delete rescue nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GptFunction
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpt-function
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - etrex kuo
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-08-04 00:00:00.000000000 Z
10
+ date: 2025-02-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dotenv
@@ -54,7 +53,6 @@ licenses:
54
53
  metadata:
55
54
  homepage_uri: https://github.com/etrex/gpt-function
56
55
  source_code_uri: https://github.com/etrex/gpt-function
57
- post_install_message:
58
56
  rdoc_options: []
59
57
  require_paths:
60
58
  - lib
@@ -69,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
67
  - !ruby/object:Gem::Version
70
68
  version: '0'
71
69
  requirements: []
72
- rubygems_version: 3.5.6
73
- signing_key:
70
+ rubygems_version: 3.6.2
74
71
  specification_version: 4
75
72
  summary: A Ruby gem for creating simple GPT-based functions.
76
73
  test_files: []