Skip to content

Commit 591fdf0

Browse files
authored
fix: JSON.fast_generate is deprecated
thanks @sferik!
2 parents 41ce053 + 0d8300b commit 591fdf0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/openai/internal/util.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ def encode_content(headers, body)
570570
content_type = headers["content-type"]
571571
case [content_type, body]
572572
in [OpenAI::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
573-
[headers, JSON.fast_generate(body)]
573+
[headers, JSON.generate(body)]
574574
in [OpenAI::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(OpenAI::Internal::Type::FileInput)
575-
[headers, body.lazy.map { JSON.fast_generate(_1) }]
575+
[headers, body.lazy.map { JSON.generate(_1) }]
576576
in [%r{^multipart/form-data}, Hash | OpenAI::Internal::Type::FileInput]
577577
boundary, strio = encode_multipart_streaming(body)
578578
headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"}

test/openai/client_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,4 @@ def test_default_headers
327327
headers.each { refute_empty(_1) }
328328
end
329329
end
330-
end
330+
end

0 commit comments

Comments
 (0)