Class: ReductoAI::Resources::Edit
- Inherits:
-
Object
- Object
- ReductoAI::Resources::Edit
- Defined in:
- lib/reducto_ai/resources/edit.rb
Overview
Note:
Edit operations consume credits based on document size and instruction complexity.
Edit resource for PDF markup and annotation operations.
Generates marked-up PDFs with highlights, annotations, or redactions based on natural language instructions.
Instance Method Summary collapse
-
#async(input:, instructions:, async: nil, **options) ⇒ Hash
Generates a marked-up PDF asynchronously.
-
#initialize(client) ⇒ Edit
constructor
private
A new instance of Edit.
-
#sync(input:, instructions:, **options) ⇒ Hash
Generates a marked-up PDF synchronously.
Constructor Details
#initialize(client) ⇒ Edit
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 Edit.
23 24 25 |
# File 'lib/reducto_ai/resources/edit.rb', line 23 def initialize(client) @client = client end |
Instance Method Details
#async(input:, instructions:, async: nil, **options) ⇒ Hash
Generates a marked-up PDF asynchronously.
Returns immediately with a job_id. Poll with Jobs#retrieve to get results.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/reducto_ai/resources/edit.rb', line 85 def async(input:, instructions:, async: nil, **) raise ArgumentError, "input is required" if input.nil? if instructions.nil? || (instructions.respond_to?(:empty?) && instructions.empty?) raise ArgumentError, "instructions are required" end payload = build_payload(input, instructions, ) payload[:async] = async unless async.nil? @client.post("/edit_async", payload) end |
#sync(input:, instructions:, **options) ⇒ Hash
Generates a marked-up PDF synchronously.
51 52 53 54 55 56 57 58 59 |
# File 'lib/reducto_ai/resources/edit.rb', line 51 def sync(input:, instructions:, **) raise ArgumentError, "input is required" if input.nil? if instructions.nil? || (instructions.respond_to?(:empty?) && instructions.empty?) raise ArgumentError, "instructions are required" end payload = build_payload(input, instructions, ) @client.post("/edit", payload) end |