ox-ai-workers 0.7.6 → 0.7.8
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +20 -0
- data/lib/oxaiworkers/delayed_request.rb +2 -2
- data/lib/oxaiworkers/module_request.rb +4 -2
- data/lib/oxaiworkers/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e8827f2d82f6cd8b30ffe30ac1a05328a6e538c083b81efe4a89a2577930e61
|
4
|
+
data.tar.gz: b467e41770580bd77031e41c8f2ebbe4c30fb775e97e29661121fbcfb7975e18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77f6e306fa76c283a672b2e44dab012c825a97472fa95a08f76ae47969d321c72c0c9399a3993087bb7941b3da84ff78e0926467db3412ef6765f5be1d18295
|
7
|
+
data.tar.gz: 4ecad4f807f605dfecb8ef36e6a24437c2046524bbc064bd7479789ddbf47bf95512a4cbfd555c5e9b5d6936aa5baeca931ba086fe9a91c94f9e8795959b0bc5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -179,6 +179,26 @@ As a worker, you can use different classes depending on your needs:
|
|
179
179
|
|
180
180
|
- `OxAiWorkers::DelayedRequest`: This class is used for batch API requests, ideal for operations that do not require immediate execution. Using `DelayedRequest` can save up to 50% on costs as requests are executed when the remote server is less busy, but no later than within 24 hours.
|
181
181
|
|
182
|
+
### Alternative Models
|
183
|
+
|
184
|
+
OxAiWorkers supports alternative compatible models like DeepSeek. To use these models, specify the appropriate base URI in the initializer:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
worker = OxAiWorkers::Request.new(
|
188
|
+
model: "deepseek-chat",
|
189
|
+
uri_base: "https://api.deepseek.com/"
|
190
|
+
)
|
191
|
+
|
192
|
+
# Or with configuration
|
193
|
+
OxAiWorkers.configure do |config|
|
194
|
+
config.uri_base = "https://api.deepseek.com/"
|
195
|
+
config.model = "deepseek-chat"
|
196
|
+
# Other configuration options...
|
197
|
+
end
|
198
|
+
```
|
199
|
+
|
200
|
+
This allows you to use any API-compatible LLM provider by simply changing the base URI.
|
201
|
+
|
182
202
|
### Rails Projects with DelayedRequest
|
183
203
|
|
184
204
|
Generate your model to store the `batch_id` in the database:
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module OxAiWorkers
|
4
4
|
class DelayedRequest < OxAiWorkers::StateBatch
|
5
|
-
def initialize(batch_id: nil, model: nil, max_tokens: nil, temperature: nil)
|
6
|
-
initialize_requests(model:, max_tokens:, temperature:)
|
5
|
+
def initialize(batch_id: nil, model: nil, max_tokens: nil, temperature: nil, uri_base: nil)
|
6
|
+
initialize_requests(model:, max_tokens:, temperature:, uri_base:)
|
7
7
|
@custom_id = nil if batch_id.present?
|
8
8
|
@batch_id = batch_id
|
9
9
|
@file_id = nil
|
@@ -3,13 +3,14 @@
|
|
3
3
|
module OxAiWorkers
|
4
4
|
class ModuleRequest
|
5
5
|
attr_accessor :result, :client, :messages, :model, :max_tokens, :custom_id, :temperature, :tools, :errors,
|
6
|
-
:tool_calls_raw, :tool_calls, :is_truncated, :finish_reason
|
6
|
+
:tool_calls_raw, :tool_calls, :is_truncated, :finish_reason, :uri_base
|
7
7
|
|
8
|
-
def initialize_requests(model: nil, max_tokens: nil, temperature: nil)
|
8
|
+
def initialize_requests(model: nil, max_tokens: nil, temperature: nil, uri_base: nil)
|
9
9
|
@max_tokens = max_tokens || OxAiWorkers.configuration.max_tokens
|
10
10
|
@custom_id = SecureRandom.uuid
|
11
11
|
@model = model || OxAiWorkers.configuration.model
|
12
12
|
@temperature = temperature || OxAiWorkers.configuration.temperature
|
13
|
+
@uri_base = uri_base
|
13
14
|
@client = nil
|
14
15
|
@is_truncated = false
|
15
16
|
@finish_reason = nil
|
@@ -26,6 +27,7 @@ module OxAiWorkers
|
|
26
27
|
def cleanup
|
27
28
|
@client ||= OpenAI::Client.new(
|
28
29
|
access_token: OxAiWorkers.configuration.access_token,
|
30
|
+
uri_base: @uri_base || OxAiWorkers.configuration.uri_base,
|
29
31
|
log_errors: true # Highly recommended in development, so you can see what errors OpenAI is returning. Not recommended in production because it could leak private data to your logs.
|
30
32
|
)
|
31
33
|
@result = nil
|
data/lib/oxaiworkers/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox-ai-workers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Smolev
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: colorize
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.6.
|
191
|
+
rubygems_version: 3.6.6
|
192
192
|
specification_version: 4
|
193
193
|
summary: A powerful state machine with OpenAI generative intelligence integration
|
194
194
|
test_files: []
|