From ca6105b6929b29adb321cead3a84706f45714b24 Mon Sep 17 00:00:00 2001 From: Michael Reinsch Date: Fri, 1 Aug 2025 16:21:29 +0200 Subject: [PATCH] fix error with openai-client and response format When using openai-client and passing a Riax::ResponseFormat as indicated in the README, openai will respond with a 400 error: ``` {"error"=>{"message"=>"Missing required parameter: 'response_format.type'.", "type"=>"invalid_request_error", "param"=>"response_format.type", "code"=>"missing_required_parameter"}} ``` This is because the library seems to be using as_json instead of to_json to convert the object. So adding this alias fixes the issue. --- lib/raix/response_format.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/raix/response_format.rb b/lib/raix/response_format.rb index a72ba0e..f334a1b 100644 --- a/lib/raix/response_format.rb +++ b/lib/raix/response_format.rb @@ -44,6 +44,8 @@ def to_schema } end + alias :as_json :to_schema + private def decode(input)