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