ox-ai-workers 0.7.0 → 0.7.2

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: ced51dc28f65c75dd2331716a9843ea3301a1979b9de929c7cecad1ec7cf1c8f
4
- data.tar.gz: 18dfa8828baf811c7a599e215fbe33700e5d2c21a52d8e597c63d9cf4187013d
3
+ metadata.gz: acc49f031b04f7f46a59bbeb85fbaf8ec6ede063d6c18c62f07318f00c34da0c
4
+ data.tar.gz: 3de498797605eacfc2cd5a0c22883d0c7f1be83261e60588284ce197a8008615
5
5
  SHA512:
6
- metadata.gz: 8e3b484f0cf492f32e4382cce682a66d50cef8e8111b6628069fd8c4b6dcd9f9a657007999c8eb966ad723285ebd1fec3176fa05e115b9c85f3db6f68f8af60c
7
- data.tar.gz: ebf148e9ee57de6f5c6c8fdda086e60dad821b88620d841d7ed66c21f18200f482eab4df97133ee1fe77cb8f0ec2cc7f433e228f43a20f31b438a4fc2f660d95
6
+ metadata.gz: 395735eb349fa0683f7b78bee1404bb63499945c0eb7e83a34cc293447bf7ea35c05ca196f220b0d793d4406611ad8e4eb25bf58435ca5fc0fbede29344a8e13
7
+ data.tar.gz: 3e726089eeea1ab240da574bbfab8cdf3d6377a2c695f47ae97f344e9f37a0f7df73fbc6d544f10e7204b001abde17691a289ce20475ef0905d8ab4795995ec4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.7.1] - 2024-08-024
2
+
3
+ - Added retry for `Iterator`
4
+
1
5
  ## [0.7.0] - 2024-08-024
2
6
 
3
7
  - Added `finish` for `Iterator`
@@ -181,6 +181,16 @@ module OxAiWorkers
181
181
  def external_request
182
182
  @worker.request!
183
183
  tick_or_wait
184
+ rescue Faraday::ServerError => e
185
+ OxAiWorkers.logger.warn "Iterator::ServerError #{e.message}. Waiting 10 seconds..."
186
+ sleep(10)
187
+ external_request
188
+ # rescue Faraday::ForbiddenError => e
189
+ # OxAiWorkers.logger.error "Iterator::ForbiddenError #{e.inspect}", for: self.class
190
+ # rescue StandardError => e
191
+ # OxAiWorkers.logger.error "Iterator::StandardError #{e.inspect}", for: self.class
192
+ # rescue OpenAI::Error => e
193
+ # OxAiWorkers.logger.error "Iterator::OpenAI::Error #{e.inspect}", for: self.class
184
194
  end
185
195
 
186
196
  def tick_or_wait
@@ -34,7 +34,7 @@ module OxAiWorkers
34
34
  end
35
35
 
36
36
  def append(role: nil, content: nil, messages: nil)
37
- @messages << { role: role, content: content } if role.present? and content.present?
37
+ @messages << { role:, content: } if role.present? and content.present?
38
38
  @messages += messages if messages.present?
39
39
  end
40
40
 
@@ -69,7 +69,7 @@ module OxAiWorkers
69
69
  @tool_calls << {
70
70
  class: function['name'].split('__').first,
71
71
  name: function['name'].split('__').last,
72
- args: args
72
+ args:
73
73
  }
74
74
  end
75
75
 
@@ -12,8 +12,6 @@ module OxAiWorkers
12
12
  def request!
13
13
  response = @client.chat(parameters: params)
14
14
  parse_choices(response)
15
- rescue OpenAI::Error => e
16
- OxAiWorkers.logger.debug(e.inspect, for: self.class)
17
15
  end
18
16
 
19
17
  def requested?
@@ -45,7 +45,7 @@ module OxAiWorkers
45
45
  # @param only [Object, Array] The object or array to initialize the white list with.
46
46
  # @return [Array] The initialized white list.
47
47
  def init_white_list_with(only)
48
- @white_list = only.is_a?(Array) ? only : [only]
48
+ @white_list = only.is_a?(Array) || only.nil? ? only : [only]
49
49
  end
50
50
 
51
51
  # Defines a function for the tool
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxAiWorkers
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox-ai-workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Smolev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-24 00:00:00.000000000 Z
11
+ date: 2024-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize