retab 0.1.3 → 0.1.5
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/lib/retab/classifications/category.rb +1 -1
- data/lib/retab/classifications/classification.rb +6 -0
- data/lib/retab/classifications/classification_request.rb +7 -4
- data/lib/retab/{jobs/job_error.rb → classifications/primitive_error.rb} +1 -1
- data/lib/retab/classifications.rb +38 -1
- data/lib/retab/client.rb +12 -16
- data/lib/retab/edits/edit.rb +6 -0
- data/lib/retab/{workflow_artifacts → edits}/edit_config.rb +1 -1
- data/lib/retab/edits/edit_request.rb +7 -4
- data/lib/retab/edits.rb +38 -1
- data/lib/retab/experiment_run_metrics/experiment_by_document_metrics_response.rb +2 -2
- data/lib/retab/experiment_run_metrics/experiment_by_target_metrics_response.rb +2 -2
- data/lib/retab/experiment_run_metrics/experiment_metrics_missing_error.rb +2 -2
- data/lib/retab/experiment_run_metrics/experiment_metrics_stale_error.rb +2 -2
- data/lib/retab/experiment_run_metrics/experiment_summary_metrics_response.rb +2 -2
- data/lib/retab/experiment_run_metrics/experiment_votes_metrics_response.rb +2 -2
- data/lib/retab/experiment_run_results/error_workflow_experiment_result.rb +2 -2
- data/lib/retab/experiment_run_results/experiment_result.rb +2 -5
- data/lib/retab/experiment_runs/experiment_run.rb +6 -3
- data/lib/retab/experiment_runs.rb +0 -10
- data/lib/retab/extractions/extraction.rb +6 -0
- data/lib/retab/extractions/extraction_request.rb +6 -3
- data/lib/retab/extractions/sources_response.rb +1 -1
- data/lib/retab/extractions.rb +38 -1
- data/lib/retab/files/create_upload_response.rb +1 -1
- data/lib/retab/files/file.rb +1 -1
- data/lib/retab/files.rb +65 -65
- data/lib/retab/parses/parse.rb +6 -0
- data/lib/retab/parses/parse_request.rb +8 -5
- data/lib/retab/parses.rb +33 -1
- data/lib/retab/partitions/partition.rb +7 -1
- data/lib/retab/partitions/partition_request.rb +8 -5
- data/lib/retab/partitions.rb +38 -1
- data/lib/retab/schemas/generate_schema_request.rb +2 -5
- data/lib/retab/schemas/partial_schema.rb +2 -2
- data/lib/retab/schemas.rb +0 -3
- data/lib/retab/splits/split.rb +6 -0
- data/lib/retab/splits/split_request.rb +7 -4
- data/lib/retab/splits/subdocument.rb +2 -2
- data/lib/retab/splits.rb +38 -1
- data/lib/retab/types/{job_status.rb → classification_status.rb} +3 -4
- data/lib/retab/types/classification_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/{supported_endpoint.rb → classifications_status.rb} +1 -1
- data/lib/retab/types/{jobs_order.rb → edit_status.rb} +1 -1
- data/lib/retab/types/edit_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/{jobs_status.rb → edits_status.rb} +1 -1
- data/lib/retab/types/{jobs_endpoint.rb → extraction_status.rb} +1 -1
- data/lib/retab/types/extraction_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/extractions_status.rb +9 -0
- data/lib/retab/types/parse_status.rb +9 -0
- data/lib/retab/types/parse_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/partition_status.rb +9 -0
- data/lib/retab/types/partition_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/partitions_status.rb +9 -0
- data/lib/retab/types/split_status.rb +9 -0
- data/lib/retab/types/split_workflow_artifact_status.rb +9 -0
- data/lib/retab/types/splits_status.rb +9 -0
- data/lib/retab/types/trigger_info_type.rb +18 -0
- data/lib/retab/types/{workflow_export_payload_request_trigger_types.rb → workflow_export_payload_request_trigger_type.rb} +1 -1
- data/lib/retab/types/workflow_runs_trigger_type.rb +1 -1
- data/lib/retab/workflow_artifacts/api_call_invocation.rb +4 -4
- data/lib/retab/workflow_artifacts/classification_workflow_artifact.rb +7 -1
- data/lib/retab/workflow_artifacts/condition_evaluation_details.rb +6 -6
- data/lib/retab/workflow_artifacts/condition_evaluation_per_item.rb +1 -1
- data/lib/retab/workflow_artifacts/condition_evaluation_result.rb +7 -7
- data/lib/retab/workflow_artifacts/condition_evaluation_sub_condition.rb +6 -6
- data/lib/retab/workflow_artifacts/conditional_evaluation.rb +4 -4
- data/lib/retab/workflow_artifacts/edit_workflow_artifact.rb +7 -1
- data/lib/retab/workflow_artifacts/extraction_workflow_artifact.rb +7 -1
- data/lib/retab/workflow_artifacts/function_invocation.rb +4 -4
- data/lib/retab/workflow_artifacts/parse_workflow_artifact.rb +7 -1
- data/lib/retab/workflow_artifacts/partition_workflow_artifact.rb +8 -2
- data/lib/retab/workflow_artifacts/review_evaluation.rb +6 -6
- data/lib/retab/workflow_artifacts/split_workflow_artifact.rb +7 -1
- data/lib/retab/workflow_artifacts/while_loop_termination.rb +4 -4
- data/lib/retab/workflow_artifacts.rb +22 -22
- data/lib/retab/workflow_block_executions/completed_block_execution_lifecycle.rb +1 -1
- data/lib/retab/workflow_block_executions/create_block_execution_request.rb +1 -1
- data/lib/retab/workflow_block_executions/error_block_execution_lifecycle.rb +1 -1
- data/lib/retab/workflow_block_executions/skipped_block_execution_lifecycle.rb +1 -1
- data/lib/retab/workflow_block_executions/stored_block_execution.rb +3 -3
- data/lib/retab/workflow_block_executions.rb +1 -1
- data/lib/retab/workflow_blocks/workflow_block.rb +1 -1
- data/lib/retab/workflow_blocks/workflow_block_create_request.rb +1 -1
- data/lib/retab/workflow_blocks.rb +7 -7
- data/lib/retab/workflow_edges.rb +3 -3
- data/lib/retab/workflow_experiments/experiment_document_capture_request.rb +3 -3
- data/lib/retab/workflow_experiments/experiment_document_provenance.rb +3 -3
- data/lib/retab/{workflow_test_run_results → workflow_experiments}/file_handle_input.rb +1 -1
- data/lib/retab/{workflow_test_run_results → workflow_experiments}/json_handle_input.rb +1 -1
- data/lib/retab/workflow_experiments/workflow_experiment.rb +3 -3
- data/lib/retab/workflow_reviews/review.rb +3 -3
- data/lib/retab/workflow_reviews/review_all_of.rb +1 -1
- data/lib/retab/workflow_reviews/review_always.rb +1 -1
- data/lib/retab/workflow_reviews/review_any_of.rb +1 -1
- data/lib/retab/workflow_reviews/review_any_required_field_null.rb +1 -1
- data/lib/retab/workflow_reviews/review_any_split_pages_lt.rb +1 -1
- data/lib/retab/workflow_reviews/review_boundary_confidence_lt.rb +1 -1
- data/lib/retab/workflow_reviews/review_branch_in.rb +1 -1
- data/lib/retab/workflow_reviews/review_category_in.rb +1 -1
- data/lib/retab/workflow_reviews/review_confidence_lt.rb +1 -1
- data/lib/retab/workflow_reviews/review_decision.rb +3 -3
- data/lib/retab/workflow_reviews/review_field_confidence_lt.rb +1 -1
- data/lib/retab/workflow_reviews/review_json_condition.rb +1 -1
- data/lib/retab/workflow_reviews/review_split_count_neq.rb +1 -1
- data/lib/retab/workflow_reviews/review_top_margin_lt.rb +1 -1
- data/lib/retab/workflow_reviews/review_validation_failed.rb +1 -1
- data/lib/retab/workflow_reviews/submit_decision_response.rb +2 -2
- data/lib/retab/workflow_runs/awaiting_review_run.rb +1 -1
- data/lib/retab/workflow_runs/cancel_workflow_response.rb +2 -2
- data/lib/retab/workflow_runs/cancelled_terminal.rb +1 -1
- data/lib/retab/workflow_runs/create_workflow_run_request.rb +1 -1
- data/lib/retab/workflow_runs/error_terminal.rb +1 -1
- data/lib/retab/workflow_runs/pending_run.rb +1 -1
- data/lib/retab/workflow_runs/run_timing.rb +2 -11
- data/lib/retab/workflow_runs/running_run.rb +1 -1
- data/lib/retab/workflow_runs/{manual_trigger.rb → trigger_info.rb} +3 -8
- data/lib/retab/workflow_runs/workflow_export_payload_request.rb +7 -7
- data/lib/retab/workflow_runs/workflow_run.rb +7 -21
- data/lib/retab/workflow_runs.rb +6 -16
- data/lib/retab/workflow_spec/declarative_apply_response.rb +2 -2
- data/lib/retab/workflow_spec/declarative_plan_field_change.rb +2 -2
- data/lib/retab/workflow_spec/declarative_plan_response.rb +2 -2
- data/lib/retab/workflow_spec/declarative_plan_summary.rb +1 -1
- data/lib/retab/workflow_spec.rb +10 -10
- data/lib/retab/workflow_steps/awaiting_review_step_lifecycle.rb +1 -1
- data/lib/retab/workflow_steps/cancelled_step_lifecycle.rb +1 -1
- data/lib/retab/workflow_steps/container_context_data.rb +1 -1
- data/lib/retab/workflow_steps/error_step_lifecycle.rb +1 -1
- data/lib/retab/workflow_steps/queued_step_lifecycle.rb +1 -1
- data/lib/retab/workflow_steps.rb +5 -10
- data/lib/retab/workflow_test_run_results/verdict_summary.rb +3 -3
- data/lib/retab/workflow_test_run_results/workflow_test_result.rb +4 -4
- data/lib/retab/{jobs/job_warning.rb → workflow_test_run_results/workflow_test_run_timing.rb} +1 -1
- data/lib/retab/workflow_test_runs/workflow_test_run.rb +7 -21
- data/lib/retab/workflow_test_runs.rb +1 -11
- data/lib/retab/workflow_tests/all_items_match_condition.rb +1 -1
- data/lib/retab/workflow_tests/any_item_matches_condition.rb +1 -1
- data/lib/retab/workflow_tests/array_contains_condition.rb +1 -1
- data/lib/retab/workflow_tests/assertion_schema_dep.rb +1 -1
- data/lib/retab/workflow_tests/between_condition.rb +2 -2
- data/lib/retab/workflow_tests/contain_condition.rb +1 -1
- data/lib/retab/workflow_tests/ends_with_condition.rb +1 -1
- data/lib/retab/workflow_tests/equal_condition.rb +1 -1
- data/lib/retab/workflow_tests/exist_condition.rb +1 -1
- data/lib/retab/workflow_tests/json_schema_valid_condition.rb +1 -1
- data/lib/retab/workflow_tests/length_compare_condition.rb +1 -1
- data/lib/retab/workflow_tests/llm_judged_as_condition.rb +1 -1
- data/lib/retab/workflow_tests/llm_not_judged_as_condition.rb +1 -1
- data/lib/retab/{workflow_test_run_results → workflow_tests}/manual_workflow_test_source.rb +1 -1
- data/lib/retab/workflow_tests/matche_regex_condition.rb +1 -1
- data/lib/retab/workflow_tests/not_contains_condition.rb +1 -1
- data/lib/retab/workflow_tests/not_equals_condition.rb +1 -1
- data/lib/retab/workflow_tests/not_exists_condition.rb +1 -1
- data/lib/retab/workflow_tests/number_compare_condition.rb +1 -1
- data/lib/retab/workflow_tests/object_contains_condition.rb +1 -1
- data/lib/retab/{workflow_test_run_results → workflow_tests}/run_step_workflow_test_source.rb +1 -1
- data/lib/retab/workflow_tests/similarity_gte_condition.rb +2 -2
- data/lib/retab/workflow_tests/split_iou_condition.rb +1 -1
- data/lib/retab/workflow_tests/start_with_condition.rb +1 -1
- data/lib/retab/workflow_tests/workflow_test.rb +2 -2
- data/lib/retab/{workflow_test_runs → workflow_tests}/workflow_test_block_target.rb +1 -1
- data/lib/retab/workflows/create_workflow_request.rb +2 -2
- data/lib/retab/workflows/publish_workflow_request.rb +1 -1
- data/lib/retab/workflows/workflow.rb +2 -2
- data/lib/retab/workflows/workflow_published.rb +1 -1
- data/lib/retab/workflows.rb +23 -0
- data/lib/retab.rb +0 -1
- data/rbi/retab/api_call_invocation.rbi +4 -4
- data/rbi/retab/classification.rbi +14 -2
- data/rbi/retab/classification_request.rbi +6 -0
- data/rbi/retab/classification_workflow_artifact.rbi +14 -2
- data/rbi/retab/classifications.rbi +14 -3
- data/rbi/retab/client.rbi +10 -13
- data/rbi/retab/condition_evaluation_details.rbi +2 -2
- data/rbi/retab/condition_evaluation_result.rbi +2 -2
- data/rbi/retab/condition_evaluation_sub_condition.rbi +2 -2
- data/rbi/retab/conditional_evaluation.rbi +4 -4
- data/rbi/retab/edit.rbi +14 -2
- data/rbi/retab/edit_request.rbi +6 -0
- data/rbi/retab/edit_workflow_artifact.rbi +16 -4
- data/rbi/retab/edits.rbi +14 -3
- data/rbi/retab/experiment_document_capture_request.rbi +2 -2
- data/rbi/retab/experiment_document_provenance.rbi +2 -2
- data/rbi/retab/experiment_result.rbi +0 -6
- data/rbi/retab/experiment_run.rbi +10 -4
- data/rbi/retab/experiment_runs.rbi +1 -3
- data/rbi/retab/extraction.rbi +12 -0
- data/rbi/retab/extraction_request.rbi +6 -0
- data/rbi/retab/extraction_workflow_artifact.rbi +14 -2
- data/rbi/retab/extractions.rbi +14 -3
- data/rbi/retab/files.rbi +17 -17
- data/rbi/retab/function_invocation.rbi +4 -4
- data/rbi/retab/generate_schema_request.rbi +0 -6
- data/rbi/retab/parse.rbi +12 -0
- data/rbi/retab/parse_request.rbi +6 -0
- data/rbi/retab/parse_workflow_artifact.rbi +12 -0
- data/rbi/retab/parses.rbi +12 -2
- data/rbi/retab/partition.rbi +12 -0
- data/rbi/retab/partition_request.rbi +6 -0
- data/rbi/retab/partition_workflow_artifact.rbi +14 -2
- data/rbi/retab/partitions.rbi +14 -3
- data/rbi/retab/{job_warning.rbi → primitive_error.rbi} +1 -1
- data/rbi/retab/review.rbi +2 -2
- data/rbi/retab/review_decision.rbi +4 -4
- data/rbi/retab/review_evaluation.rbi +2 -2
- data/rbi/retab/run_timing.rbi +0 -18
- data/rbi/retab/schemas.rbi +1 -2
- data/rbi/retab/split.rbi +14 -2
- data/rbi/retab/split_request.rbi +6 -0
- data/rbi/retab/split_workflow_artifact.rbi +14 -2
- data/rbi/retab/splits.rbi +14 -3
- data/rbi/retab/stored_block_execution.rbi +2 -2
- data/rbi/retab/{schedule_trigger.rbi → trigger_info.rbi} +3 -9
- data/rbi/retab/verdict_summary.rbi +2 -2
- data/rbi/retab/while_loop_termination.rbi +2 -2
- data/rbi/retab/workflow_artifacts.rbi +8 -8
- data/rbi/retab/workflow_export_payload_request.rbi +4 -4
- data/rbi/retab/workflow_run.rbi +12 -6
- data/rbi/retab/workflow_runs.rbi +3 -5
- data/rbi/retab/workflow_spec.rbi +4 -4
- data/rbi/retab/workflow_steps.rbi +1 -2
- data/rbi/retab/workflow_test_result.rbi +2 -2
- data/rbi/retab/workflow_test_run.rbi +12 -6
- data/rbi/retab/workflow_test_run_timing.rbi +2 -2
- data/rbi/retab/workflow_test_runs.rbi +1 -3
- data/rbi/retab/workflows.rbi +8 -0
- metadata +45 -57
- data/lib/retab/jobs/create_job_request.rb +0 -28
- data/lib/retab/jobs/job.rb +0 -70
- data/lib/retab/jobs/job_response.rb +0 -25
- data/lib/retab/jobs.rb +0 -252
- data/lib/retab/types/create_job_request_endpoint.rb +0 -34
- data/lib/retab/types/generate_schema_request_reasoning_effort.rb +0 -17
- data/lib/retab/types/jobs_source.rb +0 -14
- data/lib/retab/workflow_runs/api_trigger.rb +0 -25
- data/lib/retab/workflow_runs/email_trigger.rb +0 -28
- data/lib/retab/workflow_runs/restart_trigger.rb +0 -25
- data/lib/retab/workflow_runs/schedule_trigger.rb +0 -25
- data/lib/retab/workflow_runs/webhook_trigger.rb +0 -25
- data/lib/retab/workflow_runs/workflow_snapshot_ref.rb +0 -25
- data/lib/retab/workflow_test_runs/workflow_test_run_timing.rb +0 -31
- data/rbi/retab/api_trigger.rbi +0 -30
- data/rbi/retab/create_job_request.rbi +0 -36
- data/rbi/retab/email_trigger.rbi +0 -36
- data/rbi/retab/job.rbi +0 -120
- data/rbi/retab/job_error.rbi +0 -36
- data/rbi/retab/job_response.rbi +0 -30
- data/rbi/retab/jobs.rbi +0 -76
- data/rbi/retab/manual_trigger.rbi +0 -30
- data/rbi/retab/restart_trigger.rbi +0 -30
- data/rbi/retab/webhook_trigger.rbi +0 -30
- data/rbi/retab/workflow_snapshot_ref.rbi +0 -30
- /data/lib/retab/{extractions → classifications}/file_ref.rb +0 -0
- /data/lib/retab/{extractions → classifications}/retab_usage.rb +0 -0
- /data/lib/retab/{workflow_artifacts → edits}/b_box.rb +0 -0
- /data/lib/retab/{workflow_artifacts → edits}/edit_result.rb +0 -0
- /data/lib/retab/{workflow_artifacts → edits}/form_field.rb +0 -0
- /data/lib/retab/{workflow_runs → workflow_artifacts}/error_details.rb +0 -0
- /data/lib/retab/{workflow_steps → workflow_block_executions}/step_artifact_ref.rb +0 -0
- /data/lib/retab/{workflow_test_run_results → workflow_experiments}/materialized_document.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/cancelled_workflow_test_run.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/completed_workflow_test_run.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/error_workflow_test_run.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/pending_workflow_test_run.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/queued_workflow_test_run.rb +0 -0
- /data/lib/retab/{workflow_test_runs → workflow_test_run_results}/running_workflow_test_run.rb +0 -0
data/lib/retab/schemas.rb
CHANGED
|
@@ -13,7 +13,6 @@ module Retab
|
|
|
13
13
|
# Generate Schema From Examples
|
|
14
14
|
# @param documents [Array<Retab::MimeData, Pathname, IO, String, Hash>]
|
|
15
15
|
# @param model [String, nil]
|
|
16
|
-
# @param reasoning_effort [Retab::Types::GenerateSchemaRequestReasoningEffort, nil]
|
|
17
16
|
# @param instructions [String, nil]
|
|
18
17
|
# @param image_resolution_dpi [Integer, nil] Resolution of the image sent to the LLM
|
|
19
18
|
# @param stream [Boolean, nil]
|
|
@@ -22,7 +21,6 @@ module Retab
|
|
|
22
21
|
def generate(
|
|
23
22
|
documents:,
|
|
24
23
|
model: nil,
|
|
25
|
-
reasoning_effort: nil,
|
|
26
24
|
instructions: nil,
|
|
27
25
|
image_resolution_dpi: nil,
|
|
28
26
|
stream: nil,
|
|
@@ -32,7 +30,6 @@ module Retab
|
|
|
32
30
|
body = {
|
|
33
31
|
"documents" => documents,
|
|
34
32
|
"model" => model,
|
|
35
|
-
"reasoning_effort" => reasoning_effort,
|
|
36
33
|
"instructions" => instructions,
|
|
37
34
|
"image_resolution_dpi" => image_resolution_dpi,
|
|
38
35
|
"stream" => stream
|
data/lib/retab/splits/split.rb
CHANGED
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
14
|
instructions: :instructions,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
consensus: :consensus,
|
|
17
19
|
usage: :usage,
|
|
18
20
|
created_at: :created_at
|
|
@@ -26,6 +28,8 @@ module Retab
|
|
|
26
28
|
:n_consensus,
|
|
27
29
|
:instructions,
|
|
28
30
|
:output,
|
|
31
|
+
:status,
|
|
32
|
+
:error,
|
|
29
33
|
:consensus,
|
|
30
34
|
:usage,
|
|
31
35
|
:created_at
|
|
@@ -41,6 +45,8 @@ module Retab
|
|
|
41
45
|
@n_consensus = hash[:n_consensus]
|
|
42
46
|
@instructions = hash[:instructions]
|
|
43
47
|
@output = (hash[:output] || []).map { |item| item ? Retab::SplitResult.new(item) : nil }
|
|
48
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
49
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
44
50
|
@consensus = hash[:consensus] ? Retab::SplitConsensus.new(hash[:consensus]) : nil
|
|
45
51
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
46
52
|
@created_at = hash[:created_at]
|
|
@@ -11,7 +11,8 @@ module Retab
|
|
|
11
11
|
model: :model,
|
|
12
12
|
instructions: :instructions,
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
|
-
bust_cache: :bust_cache
|
|
14
|
+
bust_cache: :bust_cache,
|
|
15
|
+
background: :background
|
|
15
16
|
}.freeze
|
|
16
17
|
|
|
17
18
|
attr_accessor(
|
|
@@ -20,7 +21,8 @@ module Retab
|
|
|
20
21
|
:model,
|
|
21
22
|
:instructions,
|
|
22
23
|
:n_consensus,
|
|
23
|
-
:bust_cache
|
|
24
|
+
:bust_cache,
|
|
25
|
+
:background
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
def initialize(json)
|
|
@@ -28,10 +30,11 @@ module Retab
|
|
|
28
30
|
hash = self.class.normalize(json)
|
|
29
31
|
@document = hash[:document] ? Retab::MimeData.new(hash[:document]) : nil
|
|
30
32
|
@subdocuments = (hash[:subdocuments] || []).map { |item| item ? Retab::Subdocument.new(item) : nil }
|
|
31
|
-
@model = hash[:model]
|
|
33
|
+
@model = hash[:model].nil? ? "retab-small" : hash[:model]
|
|
32
34
|
@instructions = hash[:instructions]
|
|
33
35
|
@n_consensus = hash[:n_consensus]
|
|
34
|
-
@bust_cache = hash[:bust_cache]
|
|
36
|
+
@bust_cache = hash[:bust_cache].nil? ? false : hash[:bust_cache]
|
|
37
|
+
@background = hash[:background].nil? ? false : hash[:background]
|
|
35
38
|
end
|
|
36
39
|
end
|
|
37
40
|
end
|
|
@@ -21,8 +21,8 @@ module Retab
|
|
|
21
21
|
super()
|
|
22
22
|
hash = self.class.normalize(json)
|
|
23
23
|
@name = hash[:name]
|
|
24
|
-
@description = hash[:description]
|
|
25
|
-
@allow_multiple_instances = hash[:allow_multiple_instances]
|
|
24
|
+
@description = hash[:description].nil? ? "" : hash[:description]
|
|
25
|
+
@allow_multiple_instances = hash[:allow_multiple_instances].nil? ? false : hash[:allow_multiple_instances]
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
data/lib/retab/splits.rb
CHANGED
|
@@ -16,6 +16,7 @@ module Retab
|
|
|
16
16
|
# @param limit [Integer, nil]
|
|
17
17
|
# @param order [Retab::Types::SplitsOrder, nil]
|
|
18
18
|
# @param filename [String, nil]
|
|
19
|
+
# @param status [Retab::Types::SplitsStatus, nil]
|
|
19
20
|
# @param from_date [String, nil]
|
|
20
21
|
# @param to_date [String, nil]
|
|
21
22
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
@@ -26,6 +27,7 @@ module Retab
|
|
|
26
27
|
limit: 10,
|
|
27
28
|
order: "desc",
|
|
28
29
|
filename: nil,
|
|
30
|
+
status: nil,
|
|
29
31
|
from_date: nil,
|
|
30
32
|
to_date: nil,
|
|
31
33
|
request_options: {}
|
|
@@ -36,6 +38,7 @@ module Retab
|
|
|
36
38
|
"limit" => limit,
|
|
37
39
|
"order" => order,
|
|
38
40
|
"filename" => filename,
|
|
41
|
+
"status" => status,
|
|
39
42
|
"from_date" => from_date,
|
|
40
43
|
"to_date" => to_date
|
|
41
44
|
}.compact
|
|
@@ -53,6 +56,7 @@ module Retab
|
|
|
53
56
|
limit: limit,
|
|
54
57
|
order: order,
|
|
55
58
|
filename: filename,
|
|
59
|
+
status: status,
|
|
56
60
|
from_date: from_date,
|
|
57
61
|
to_date: to_date,
|
|
58
62
|
request_options: request_options
|
|
@@ -66,6 +70,7 @@ module Retab
|
|
|
66
70
|
limit: limit,
|
|
67
71
|
order: order,
|
|
68
72
|
filename: filename,
|
|
73
|
+
status: status,
|
|
69
74
|
from_date: from_date,
|
|
70
75
|
to_date: to_date
|
|
71
76
|
},
|
|
@@ -80,6 +85,7 @@ module Retab
|
|
|
80
85
|
# @param instructions [String, nil] Free-form instructions appended to the system prompt to steer the split.
|
|
81
86
|
# @param n_consensus [Integer, nil] Number of consensus split runs to perform. Uses deterministic single-pass when set to 1.
|
|
82
87
|
# @param bust_cache [Boolean, nil] If true, skip the LLM cache and force a fresh completion
|
|
88
|
+
# @param background [Boolean, nil] If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1/<primitive>/{id} until status is terminal. Mutually exclusive with stream.
|
|
83
89
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
84
90
|
# @return [Retab::Split]
|
|
85
91
|
def create(
|
|
@@ -89,6 +95,7 @@ module Retab
|
|
|
89
95
|
instructions: nil,
|
|
90
96
|
n_consensus: nil,
|
|
91
97
|
bust_cache: nil,
|
|
98
|
+
background: nil,
|
|
92
99
|
request_options: {}
|
|
93
100
|
)
|
|
94
101
|
document = Retab::MimeData.coerce(document) unless document.nil?
|
|
@@ -98,7 +105,8 @@ module Retab
|
|
|
98
105
|
"model" => model,
|
|
99
106
|
"instructions" => instructions,
|
|
100
107
|
"n_consensus" => n_consensus,
|
|
101
|
-
"bust_cache" => bust_cache
|
|
108
|
+
"bust_cache" => bust_cache,
|
|
109
|
+
"background" => background
|
|
102
110
|
}.compact
|
|
103
111
|
response = @client.request(
|
|
104
112
|
method: :post,
|
|
@@ -118,16 +126,22 @@ module Retab
|
|
|
118
126
|
|
|
119
127
|
# Get Split
|
|
120
128
|
# @param split_id [String]
|
|
129
|
+
# @param include_output [Boolean, nil] When false, returns a cheap status-only projection (no output), served from cache for in-flight background runs.
|
|
121
130
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
122
131
|
# @return [Retab::Split]
|
|
123
132
|
def get(
|
|
124
133
|
split_id:,
|
|
134
|
+
include_output: true,
|
|
125
135
|
request_options: {}
|
|
126
136
|
)
|
|
137
|
+
params = {
|
|
138
|
+
"include_output" => include_output
|
|
139
|
+
}.compact
|
|
127
140
|
response = @client.request(
|
|
128
141
|
method: :get,
|
|
129
142
|
path: "/v1/splits/#{Retab::Util.encode_path(split_id)}",
|
|
130
143
|
auth: true,
|
|
144
|
+
params: params,
|
|
131
145
|
request_options: request_options
|
|
132
146
|
)
|
|
133
147
|
result = Retab::Split.new(response.body)
|
|
@@ -155,5 +169,28 @@ module Retab
|
|
|
155
169
|
)
|
|
156
170
|
nil
|
|
157
171
|
end
|
|
172
|
+
|
|
173
|
+
# Cancel Split
|
|
174
|
+
# @param split_id [String]
|
|
175
|
+
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
176
|
+
# @return [Retab::Split]
|
|
177
|
+
def create_split_cancel(
|
|
178
|
+
split_id:,
|
|
179
|
+
request_options: {}
|
|
180
|
+
)
|
|
181
|
+
response = @client.request(
|
|
182
|
+
method: :post,
|
|
183
|
+
path: "/v1/splits/#{Retab::Util.encode_path(split_id)}/cancel",
|
|
184
|
+
auth: true,
|
|
185
|
+
request_options: request_options
|
|
186
|
+
)
|
|
187
|
+
result = Retab::Split.new(response.body)
|
|
188
|
+
result.last_response = Retab::Types::ApiResponse.new(
|
|
189
|
+
http_status: response.code.to_i,
|
|
190
|
+
http_headers: response.each_header.to_h,
|
|
191
|
+
request_id: response["x-request-id"]
|
|
192
|
+
)
|
|
193
|
+
result
|
|
194
|
+
end
|
|
158
195
|
end
|
|
159
196
|
end
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
module Retab
|
|
6
6
|
module Types
|
|
7
|
-
class
|
|
8
|
-
|
|
7
|
+
class ClassificationStatus
|
|
8
|
+
PENDING = "pending"
|
|
9
9
|
QUEUED = "queued"
|
|
10
10
|
IN_PROGRESS = "in_progress"
|
|
11
11
|
COMPLETED = "completed"
|
|
12
12
|
FAILED = "failed"
|
|
13
13
|
CANCELLED = "cancelled"
|
|
14
|
-
|
|
15
|
-
ALL = [VALIDATING, QUEUED, IN_PROGRESS, COMPLETED, FAILED, CANCELLED, EXPIRED].freeze
|
|
14
|
+
ALL = [PENDING, QUEUED, IN_PROGRESS, COMPLETED, FAILED, CANCELLED].freeze
|
|
16
15
|
end
|
|
17
16
|
end
|
|
18
17
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
module Types
|
|
7
|
+
class TriggerInfoType
|
|
8
|
+
MANUAL = "manual"
|
|
9
|
+
API = "api"
|
|
10
|
+
SCHEDULE = "schedule"
|
|
11
|
+
WEBHOOK = "webhook"
|
|
12
|
+
EMAIL = "email"
|
|
13
|
+
CUSTOM = "custom"
|
|
14
|
+
RESTART = "restart"
|
|
15
|
+
ALL = [MANUAL, API, SCHEDULE, WEBHOOK, EMAIL, CUSTOM, RESTART].freeze
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -8,7 +8,7 @@ module Retab
|
|
|
8
8
|
HASH_ATTRS = {
|
|
9
9
|
operation: :operation,
|
|
10
10
|
id: :id,
|
|
11
|
-
|
|
11
|
+
run_id: :run_id,
|
|
12
12
|
step_id: :step_id,
|
|
13
13
|
attempts: :attempts,
|
|
14
14
|
error: :error,
|
|
@@ -18,7 +18,7 @@ module Retab
|
|
|
18
18
|
attr_accessor(
|
|
19
19
|
:operation,
|
|
20
20
|
:id,
|
|
21
|
-
:
|
|
21
|
+
:run_id,
|
|
22
22
|
:step_id,
|
|
23
23
|
:attempts,
|
|
24
24
|
:error,
|
|
@@ -28,9 +28,9 @@ module Retab
|
|
|
28
28
|
def initialize(json)
|
|
29
29
|
super()
|
|
30
30
|
hash = self.class.normalize(json)
|
|
31
|
-
@operation = hash[:operation]
|
|
31
|
+
@operation = hash[:operation].nil? ? "api_call_invocation" : hash[:operation]
|
|
32
32
|
@id = hash[:id]
|
|
33
|
-
@
|
|
33
|
+
@run_id = hash[:run_id]
|
|
34
34
|
@step_id = hash[:step_id]
|
|
35
35
|
@attempts = (hash[:attempts] || []).map { |item| item ? Retab::ApiCallAttempt.new(item) : nil }
|
|
36
36
|
@error = hash[:error] ? Retab::ErrorDetails.new(hash[:error]) : nil
|
|
@@ -13,6 +13,8 @@ module Retab
|
|
|
13
13
|
n_consensus: :n_consensus,
|
|
14
14
|
instructions: :instructions,
|
|
15
15
|
output: :output,
|
|
16
|
+
status: :status,
|
|
17
|
+
error: :error,
|
|
16
18
|
consensus: :consensus,
|
|
17
19
|
usage: :usage,
|
|
18
20
|
created_at: :created_at,
|
|
@@ -27,6 +29,8 @@ module Retab
|
|
|
27
29
|
:n_consensus,
|
|
28
30
|
:instructions,
|
|
29
31
|
:output,
|
|
32
|
+
:status,
|
|
33
|
+
:error,
|
|
30
34
|
:consensus,
|
|
31
35
|
:usage,
|
|
32
36
|
:created_at,
|
|
@@ -43,10 +47,12 @@ module Retab
|
|
|
43
47
|
@n_consensus = hash[:n_consensus]
|
|
44
48
|
@instructions = hash[:instructions]
|
|
45
49
|
@output = hash[:output] ? Retab::ClassificationDecision.new(hash[:output]) : nil
|
|
50
|
+
@status = hash[:status].nil? ? "pending" : hash[:status]
|
|
51
|
+
@error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
|
|
46
52
|
@consensus = hash[:consensus] ? Retab::ClassificationConsensus.new(hash[:consensus]) : nil
|
|
47
53
|
@usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
|
|
48
54
|
@created_at = hash[:created_at]
|
|
49
|
-
@operation = hash[:operation]
|
|
55
|
+
@operation = hash[:operation].nil? ? "classification" : hash[:operation]
|
|
50
56
|
end
|
|
51
57
|
end
|
|
52
58
|
end
|
|
@@ -11,7 +11,7 @@ module Retab
|
|
|
11
11
|
expected: :expected,
|
|
12
12
|
actual: :actual,
|
|
13
13
|
matched: :matched,
|
|
14
|
-
|
|
14
|
+
items: :items,
|
|
15
15
|
sub_conditions: :sub_conditions,
|
|
16
16
|
logical_operator: :logical_operator
|
|
17
17
|
}.freeze
|
|
@@ -22,7 +22,7 @@ module Retab
|
|
|
22
22
|
:expected,
|
|
23
23
|
:actual,
|
|
24
24
|
:matched,
|
|
25
|
-
:
|
|
25
|
+
:items,
|
|
26
26
|
:sub_conditions,
|
|
27
27
|
:logical_operator
|
|
28
28
|
)
|
|
@@ -30,12 +30,12 @@ module Retab
|
|
|
30
30
|
def initialize(json)
|
|
31
31
|
super()
|
|
32
32
|
hash = self.class.normalize(json)
|
|
33
|
-
@path = hash[:path]
|
|
34
|
-
@operator = hash[:operator]
|
|
33
|
+
@path = hash[:path].nil? ? "" : hash[:path]
|
|
34
|
+
@operator = hash[:operator].nil? ? "" : hash[:operator]
|
|
35
35
|
@expected = hash[:expected]
|
|
36
36
|
@actual = hash[:actual]
|
|
37
|
-
@matched = hash[:matched]
|
|
38
|
-
@
|
|
37
|
+
@matched = hash[:matched].nil? ? false : hash[:matched]
|
|
38
|
+
@items = (hash[:items] || []).map { |item| item ? Retab::ConditionEvaluationPerItem.new(item) : nil }
|
|
39
39
|
@sub_conditions = (hash[:sub_conditions] || []).map { |item|
|
|
40
40
|
item ? Retab::ConditionEvaluationSubCondition.new(item) : nil
|
|
41
41
|
}
|
|
@@ -14,7 +14,7 @@ module Retab
|
|
|
14
14
|
matched: :matched,
|
|
15
15
|
branch_name: :branch_name,
|
|
16
16
|
logical_operator: :logical_operator,
|
|
17
|
-
|
|
17
|
+
items: :items,
|
|
18
18
|
sub_evaluations: :sub_evaluations,
|
|
19
19
|
details: :details
|
|
20
20
|
}.freeze
|
|
@@ -28,7 +28,7 @@ module Retab
|
|
|
28
28
|
:matched,
|
|
29
29
|
:branch_name,
|
|
30
30
|
:logical_operator,
|
|
31
|
-
:
|
|
31
|
+
:items,
|
|
32
32
|
:sub_evaluations,
|
|
33
33
|
:details
|
|
34
34
|
)
|
|
@@ -37,14 +37,14 @@ module Retab
|
|
|
37
37
|
super()
|
|
38
38
|
hash = self.class.normalize(json)
|
|
39
39
|
@condition_id = hash[:condition_id]
|
|
40
|
-
@path = hash[:path]
|
|
41
|
-
@operator = hash[:operator]
|
|
40
|
+
@path = hash[:path].nil? ? "" : hash[:path]
|
|
41
|
+
@operator = hash[:operator].nil? ? "" : hash[:operator]
|
|
42
42
|
@expected = hash[:expected]
|
|
43
43
|
@actual = hash[:actual]
|
|
44
|
-
@matched = hash[:matched]
|
|
45
|
-
@branch_name = hash[:branch_name]
|
|
44
|
+
@matched = hash[:matched].nil? ? false : hash[:matched]
|
|
45
|
+
@branch_name = hash[:branch_name].nil? ? "exit" : hash[:branch_name]
|
|
46
46
|
@logical_operator = hash[:logical_operator]
|
|
47
|
-
@
|
|
47
|
+
@items = (hash[:items] || []).map { |item| item ? Retab::ConditionEvaluationPerItem.new(item) : nil }
|
|
48
48
|
@sub_evaluations = (hash[:sub_evaluations] || []).map { |item|
|
|
49
49
|
item ? Retab::ConditionEvaluationSubCondition.new(item) : nil
|
|
50
50
|
}
|
|
@@ -12,7 +12,7 @@ module Retab
|
|
|
12
12
|
expected: :expected,
|
|
13
13
|
actual: :actual,
|
|
14
14
|
matched: :matched,
|
|
15
|
-
|
|
15
|
+
items: :items
|
|
16
16
|
}.freeze
|
|
17
17
|
|
|
18
18
|
attr_accessor(
|
|
@@ -22,19 +22,19 @@ module Retab
|
|
|
22
22
|
:expected,
|
|
23
23
|
:actual,
|
|
24
24
|
:matched,
|
|
25
|
-
:
|
|
25
|
+
:items
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
def initialize(json)
|
|
29
29
|
super()
|
|
30
30
|
hash = self.class.normalize(json)
|
|
31
31
|
@sub_condition_id = hash[:sub_condition_id]
|
|
32
|
-
@path = hash[:path]
|
|
33
|
-
@operator = hash[:operator]
|
|
32
|
+
@path = hash[:path].nil? ? "" : hash[:path]
|
|
33
|
+
@operator = hash[:operator].nil? ? "" : hash[:operator]
|
|
34
34
|
@expected = hash[:expected]
|
|
35
35
|
@actual = hash[:actual]
|
|
36
|
-
@matched = hash[:matched]
|
|
37
|
-
@
|
|
36
|
+
@matched = hash[:matched].nil? ? false : hash[:matched]
|
|
37
|
+
@items = (hash[:items] || []).map { |item| item ? Retab::ConditionEvaluationPerItem.new(item) : nil }
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -8,7 +8,7 @@ module Retab
|
|
|
8
8
|
HASH_ATTRS = {
|
|
9
9
|
operation: :operation,
|
|
10
10
|
id: :id,
|
|
11
|
-
|
|
11
|
+
run_id: :run_id,
|
|
12
12
|
step_id: :step_id,
|
|
13
13
|
evaluations: :evaluations,
|
|
14
14
|
selected_handles: :selected_handles,
|
|
@@ -20,7 +20,7 @@ module Retab
|
|
|
20
20
|
attr_accessor(
|
|
21
21
|
:operation,
|
|
22
22
|
:id,
|
|
23
|
-
:
|
|
23
|
+
:run_id,
|
|
24
24
|
:step_id,
|
|
25
25
|
:evaluations,
|
|
26
26
|
:selected_handles,
|
|
@@ -32,9 +32,9 @@ module Retab
|
|
|
32
32
|
def initialize(json)
|
|
33
33
|
super()
|
|
34
34
|
hash = self.class.normalize(json)
|
|
35
|
-
@operation = hash[:operation]
|
|
35
|
+
@operation = hash[:operation].nil? ? "conditional_evaluation" : hash[:operation]
|
|
36
36
|
@id = hash[:id]
|
|
37
|
-
@
|
|
37
|
+
@run_id = hash[:run_id]
|
|
38
38
|
@step_id = hash[:step_id]
|
|
39
39
|
@evaluations = (hash[:evaluations] || []).map { |item| item ? Retab::ConditionEvaluationResult.new(item) : nil }
|
|
40
40
|
@selected_handles = (hash[:selected_handles] || [])
|