Method: OpenRouter::HTTP#post
- Defined in:
- lib/open_router/http.rb
#post(path:, parameters:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/open_router/http.rb', line 11 def post(path:, parameters:) conn.post(uri(path:)) do |req| if parameters[:stream].respond_to?(:call) req..on_data = to_json_stream(user_proc: parameters[:stream]) parameters[:stream] = true # Necessary to tell OpenRouter to stream. end req.headers = headers req.body = parameters.to_json end&.body end |