Class: CleoQualityReview::LlmProviders::OpenAi::HttpRequest
- Inherits:
-
Struct
- Object
- Struct
- CleoQualityReview::LlmProviders::OpenAi::HttpRequest
- Defined in:
- lib/cleo_quality_review/llm_providers/open_ai.rb
Overview
Value object for a JSON POST request to OpenAI.
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#execute(http_request) {|Net::HTTP| ... } ⇒ Object
Execute the HTTP request.
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
33 34 35 |
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 33 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers
33 34 35 |
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 33 def headers @headers end |
#timeout_seconds ⇒ Object
Returns the value of attribute timeout_seconds
33 34 35 |
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 33 def timeout_seconds @timeout_seconds end |
#uri ⇒ Object
Returns the value of attribute uri
33 34 35 |
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 33 def uri @uri end |
Instance Method Details
#execute(http_request) {|Net::HTTP| ... } ⇒ Object
Execute the HTTP request.
39 40 41 42 43 44 45 46 |
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 39 def execute(http_request) Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http| http.open_timeout = timeout_seconds http.read_timeout = timeout_seconds http.write_timeout = timeout_seconds http.request(http_request) end end |