ChatGPTCLIBot: Error parsing JSON: unexpected ','; expected end of input
I am consistently getting the following error when using the application (even when using the latest Development build):
Error when calling API: Error parsing JSON: [json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected ','; expected end of input
Essentially, this happens after the output to a query. Could it be that the OpenAI API is returning non-standard JSON with trailing ,
symbols? Or that the API output looks different to the expected output?
I think the issue is happening somewhere in handle_streamed_response
inside main/interface/network/Network.cpp
Unfortunately, I am unable to compile on my Linux (Manjaro) machine to confirm the cause or find a fix. But perhaps an additional line to remove a trailing ,
here might help?
//Remove leading and trailing whitespaces and new lines.
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char c){return !std::isspace(c) && c != '\n';}));
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char c){return !std::isspace(c) && c != '\n';}).base(), s.end());
For completeness, my compile error is:
CMake Error at CMakeLists.txt:18 (find_package):
Could not find a package configuration file provided by "CURL" with any of
the following names:
CURLConfig.cmake
curl-config.cmake
Add the installation prefix of "CURL" to CMAKE_PREFIX_PATH or set
"CURL_DIR" to a directory containing one of the above files. If "CURL"
provides a separate development package or SDK, be sure it has been
installed.
I am not super familiar with CMake but I do have cUrl installed on my machine. It might be useful to have a section in the README about what is needed to compile, as this is making me think I need to pass a specific parameter to CMake or provide it with cUrl source code in someway,
About this issue
- Original URL
- State: open
- Created 8 months ago
- Comments: 22 (8 by maintainers)
@LyndonArmitage I know what’s happening, it’s not with the regex but OpenAI giving SSE in small chunks, I will fix this some day but I’m very busy at the moment…