Class: ReductoAI::Resources::Split
- Inherits:
-
Object
- Object
- ReductoAI::Resources::Split
- Defined in:
- lib/reducto_ai/resources/split.rb
Overview
Note:
Split operations consume credits based on document size.
Split resource for document splitting operations.
Divides documents into logical sections based on content structure, returning page ranges and metadata for each section.
Instance Method Summary collapse
-
#async(input:, async: nil, **options) ⇒ Hash
Splits a document into sections asynchronously.
-
#initialize(client) ⇒ Split
constructor
private
A new instance of Split.
-
#sync(input:, **options) ⇒ Hash
Splits a document into sections synchronously.
Constructor Details
#initialize(client) ⇒ Split
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Split.
23 24 25 |
# File 'lib/reducto_ai/resources/split.rb', line 23 def initialize(client) @client = client end |
Instance Method Details
#async(input:, async: nil, **options) ⇒ Hash
Splits a document into sections asynchronously.
Returns immediately with a job_id. Poll with Jobs#retrieve to get results.
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/reducto_ai/resources/split.rb', line 78 def async(input:, async: nil, **) raise ArgumentError, "input is required" if input.nil? normalized_input = normalize_input(input) payload = { input: normalized_input } payload[:async] = async unless async.nil? payload.merge!(.compact) @client.post("/split_async", payload) end |
#sync(input:, **options) ⇒ Hash
Splits a document into sections synchronously.
48 49 50 51 52 53 54 |
# File 'lib/reducto_ai/resources/split.rb', line 48 def sync(input:, **) raise ArgumentError, "input is required" if input.nil? normalized_input = normalize_input(input) payload = { input: normalized_input, ** }.compact @client.post("/split", payload) end |