Class: LLM::Response
- Inherits:
-
Object
- Object
- LLM::Response
- Defined in:
- lib/llm/response.rb
Direct Known Subclasses
Audio, AudioTranscription, AudioTranslation, Completion, DownloadFile, Embedding, File, FileList, Image, Output
Defined Under Namespace
Classes: Audio, AudioTranscription, AudioTranslation, Completion, DownloadFile, Embedding, File, FileList, Image, Output
Instance Method Summary collapse
-
#body ⇒ Hash, String
Returns the response body.
-
#initialize(res) ⇒ LLM::Response
constructor
Returns an instance of LLM::Response.
Constructor Details
#initialize(res) ⇒ LLM::Response
Returns an instance of LLM::Response
22 23 24 |
# File 'lib/llm/response.rb', line 22 def initialize(res) @res = res end |
Instance Method Details
#body ⇒ Hash, String
Returns the response body
29 30 31 32 33 34 |
# File 'lib/llm/response.rb', line 29 def body @body ||= case @res["content-type"] when %r|\Aapplication/json\s*| then JSON.parse(@res.body) else @res.body end end |