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