Class: Async::Ollama::Wrapper
- Inherits:
-
REST::Wrapper::Generic
- Object
- REST::Wrapper::Generic
- Async::Ollama::Wrapper
show all
- Defined in:
- lib/async/ollama/wrapper.rb
Defined Under Namespace
Classes: StreamingResponseParser
Constant Summary
collapse
- APPLICATION_JSON =
"application/json"
- APPLICATION_JSON_STREAM =
"application/x-ndjson"
Instance Method Summary
collapse
Instance Method Details
#parser_for(response) ⇒ Object
#prepare_request(request, payload) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/async/ollama/wrapper.rb', line 20
def prepare_request(request, payload)
request..add("accept", APPLICATION_JSON)
request..add("accept", APPLICATION_JSON_STREAM)
if payload
request.["content-type"] = APPLICATION_JSON
request.body = ::Protocol::HTTP::Body::Buffered.new([
::JSON.dump(payload)
])
end
end
|