Class: Llmclt::Fetcher
- Inherits:
-
Object
- Object
- Llmclt::Fetcher
- Defined in:
- lib/llmclt/fetcher.rb
Instance Method Summary collapse
- #batch_run(batch_job_name, gcs_input_uri, gcs_output_uri) ⇒ Object
- #batch_state_run(batch_job_id) ⇒ Object
-
#initialize(config) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #run(prompt, stream: false, histories: []) ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(config) ⇒ Fetcher
Returns a new instance of Fetcher.
5 6 7 8 |
# File 'lib/llmclt/fetcher.rb', line 5 def initialize(config) @config = config @pool = Llmclt::Http::ConnectionPool.new end |
Instance Method Details
#batch_run(batch_job_name, gcs_input_uri, gcs_output_uri) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/llmclt/fetcher.rb', line 21 def batch_run(batch_job_name, gcs_input_uri, gcs_output_uri) request = Llmclt::Request::Batch.new( request_headers, @config, batch_job_name: batch_job_name, gcs_input_uri: gcs_input_uri, gcs_output_uri: gcs_output_uri ) request_http(request) end |
#batch_state_run(batch_job_id) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/llmclt/fetcher.rb', line 32 def batch_state_run(batch_job_id) request = Llmclt::Request::Batch.new( request_headers, @config, batch_job_id: batch_job_id ) request_http(request) end |
#run(prompt, stream: false, histories: []) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/llmclt/fetcher.rb', line 10 def run(prompt, stream: false, histories: []) request = build_request( request_mode(stream), request_headers, @config, prompt, histories ) request_http(request) end |
#shutdown ⇒ Object
41 42 43 |
# File 'lib/llmclt/fetcher.rb', line 41 def shutdown @pool.shutdown end |