Class: Async::Ollama::ChatWrapper
- Defined in:
- lib/async/ollama/wrapper.rb
Overview
Wraps chat-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 chat HTTP response.
Methods inherited from Wrapper
Instance Method Details
#parser_for(response) ⇒ Object
Selects the appropriate parser for the chat HTTP response.
174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/async/ollama/wrapper.rb', line 174 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 StreamingMessageParser end end |