Class: Llmclt::Request::Batch

Inherits:
Base
  • Object
show all
Defined in:
lib/llmclt/request/batch.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Llmclt::Request::Base

Instance Method Details

#build_response(response) ⇒ Object



24
25
26
# File 'lib/llmclt/request/batch.rb', line 24

def build_response(response)
  Llmclt::Response::Batch.new(response)
end

#contentObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/llmclt/request/batch.rb', line 12

def content
  if @batch_job_id
    request = Net::HTTP::Get.new(endpoint_uri.request_uri)
    @headers.each do |key, value|
      request[key] = value
    end
    request
  else
    super
  end
end

#endpoint_uriObject



6
7
8
9
10
# File 'lib/llmclt/request/batch.rb', line 6

def endpoint_uri
  url = "https://#{endpoint_host}/v1/projects/#{@config.project_id}/locations/#{@config.location_id}/batchPredictionJobs"
  url = "#{url}/#{@batch_job_id}" if @batch_job_id
  URI.parse(url)
end