Retrieving contents of CSV file errors on JSON parsing
Closed this issue · 3 comments
Describe the bug
The OpenAI Assistant has generated a CSV file. When I attempt to retrieve its contents with openai_client.files.content(id: 'file_id') it generates the error unexpected character (after [0]) at line 1, column 2 [parse.c:744] which appears to be the JSON parser trying to parse CSV content.
To Reproduce
openai_client.files.retrieve id: "file-NexuEUjWpoehzmkQ5zer7W"
{"object"=>"file",
"id"=>"file-NexuEUjWpoehzmkQ5zer7W",
"purpose"=>"assistants_output",
"filename"=>"/mnt/data/normalized_file.csv",
"bytes"=>1630,
"created_at"=>1738176534,
"status"=>"processed",
"status_details"=>nil}
openai_client.files.content id: "file-NexuEUjWpoehzmkQ5zer7W"
: unexpected character (after [0]) at line 1, column 2 [parse.c:744]
Expected behavior
The CSV file contents are able to be read without error.
Desktop (please complete the following information):
- OS: macOS 15.2
- Ruby version: 3.2.2
- Gem version: 7.3.1
Same issue. Appears to be coming from
https://github.com/alexrudall/ruby-openai/blob/main/lib/openai/http.rb#L10
because content simply calls .get and assumes that everything returning is a jsonl
ruby-openai/lib/openai/files.rb
Line 37 in c87e36e
Will need to make a direct Faraday call for now..
I believe #566 resolves this issue - if you are able to could you give it a test @nuclearghost , @james-jang ? Thank you!
Fixed in ruby-openai v8