Closed Lasvad closed 2 weeks ago
Describe the bug Reading files such as pngs that are generated by code interpreter seem to fail as the response is expected to be JSON
Doc reference this to read file content: client.files.content(id: "file-123")
client.files.content(id: "file-123")
example
Code interpreter returns...
"content"=> [{"type"=>"image_file", "image_file"=>{"file_id"=>"file-stub"}}, {"type"=>"text", "text"=> {"value"=>
using the cmd
client.files.content(id: "file-stub")
returns
(JSON::ParserError)s/ruby-3.2.2/lib/ruby/3.2.0/json/common.rb:216:in `parse': unexpected token at '\x89PNG
I've tried to use File.write, TempFile, StringIO but the JSON parse error continues.
To Reproduce Steps to reproduce the behavior:
Expected behavior Need a way to parse image_files files from OpenAI
Screenshots
Desktop (please complete the following information):
Additional context ruby 3.2.2 Rails 7.0.4.3
Duplicate of this issue
Closing for #421
Describe the bug Reading files such as pngs that are generated by code interpreter seem to fail as the response is expected to be JSON
Doc reference this to read file content:
client.files.content(id: "file-123")
example
Code interpreter returns...
using the cmd
returns
I've tried to use File.write, TempFile, StringIO but the JSON parse error continues.
To Reproduce Steps to reproduce the behavior:
client.files.content(id: "file-123")
Expected behavior Need a way to parse image_files files from OpenAI
Screenshots
Desktop (please complete the following information):
Additional context ruby 3.2.2 Rails 7.0.4.3