Class: Raif::ModelCompletionBatches::OpenAi

Inherits:
Raif::ModelCompletionBatch show all
Defined in:
app/models/raif/model_completion_batches/open_ai.rb

Overview

OpenAI batch persistence. The OpenAI Batches API is a three-step flow: upload a JSONL file, create a batch referencing it, poll, then download the output file. The relevant identifiers are tracked in provider_response:

{
"input_file_id" => "file_...",
"output_file_id" => "file_...",
"error_file_id" => "file_...",
"endpoint" => "/v1/responses"
}

Constant Summary

Constants inherited from Raif::ModelCompletionBatch

Raif::ModelCompletionBatch::STATUSES, Raif::ModelCompletionBatch::TERMINAL_STATUSES

Instance Method Summary collapse

Methods inherited from Raif::ModelCompletionBatch

#add_task, #assert_submittable!, #cancel!, #dispatch_completion_handler!, #enqueue_first_poll!, #expire!, #fetch_results!, #fetch_status!, #finalize!, #force_fail!, #llm, #max_age_exceeded?, #recalculate_costs!, #submit!, #successful?, #tasks, #terminal?

Instance Method Details

#endpointObject



67
68
69
# File 'app/models/raif/model_completion_batches/open_ai.rb', line 67

def endpoint
  provider_response&.dig("endpoint")
end

#error_file_idObject



63
64
65
# File 'app/models/raif/model_completion_batches/open_ai.rb', line 63

def error_file_id
  provider_response&.dig("error_file_id")
end

#input_file_idObject



55
56
57
# File 'app/models/raif/model_completion_batches/open_ai.rb', line 55

def input_file_id
  provider_response&.dig("input_file_id")
end

#output_file_idObject



59
60
61
# File 'app/models/raif/model_completion_batches/open_ai.rb', line 59

def output_file_id
  provider_response&.dig("output_file_id")
end