Class: Async::Ollama::GenerateWrapper
- Defined in:
- lib/async/ollama/wrapper.rb
Overview
Wraps generate-specific HTTP responses for the Ollama API, selecting the appropriate parser.
Constant Summary
Constants inherited from Wrapper
Wrapper::APPLICATION_JSON, Wrapper::APPLICATION_JSON_STREAM
Instance Method Summary collapse
-
#parser_for(response) ⇒ Object
Selects the appropriate parser for the generate HTTP response.
Methods inherited from Wrapper
Instance Method Details
#parser_for(response) ⇒ Object
Selects the appropriate parser for the generate HTTP response.
156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/async/ollama/wrapper.rb', line 156 def parser_for(response) content_type = response.headers["content-type"] media_type = content_type.split(";").first case media_type when APPLICATION_JSON return Async::REST::Wrapper::JSON::Parser when APPLICATION_JSON_STREAM return StreamingResponseParser end end |