liboai icon indicating copy to clipboard operation
liboai copied to clipboard

Error from cURL: Failed writing received data to disk/application

Open NlGHT opened this issue 1 year ago • 0 comments

Describe the bug

I am trying to test run the example for generating completions within a code base just to get up and running with a project I'm trying to make: documentation/completions/examples/generate_completion.cpp

I am running Alpine Linux Edge which currently has curl at version 8.7.1 and might be the issue.

To Reproduce

Run the mentioned code example documentation/completions/examples/generate_completion.cpp with one difference being that I use SetKey instead of SetKeyEnv.

Code passes through the authentication fine and I can see that the request is received by OpenAI because my "Last Used" metric on the website has updated (began as "Never Used" - this started on a fresh API key).

Result is this error: liboai::netimpl::Session::Perform(): Failed writing received data to disk/application (E_CURLERROR:0x06)

Code snippets

OpenAI oai;
if (oai.auth.SetKey(apiKey)) {
	try {
		Response response = oai.Completion->create(
				"text-davinci-003",
				"Say this is a test",
				std::nullopt,
				7
				);
		std::cout << response["choices"][0]["text"].get<std::string>() << std::endl;
	}
	catch (std::exception& e) {
		std::cout << e.what() << std::endl;
	}
}

OS

Alpine Linux Edge (at post date)

Library version

liboai: main branch at issue post date, curl: 8.7.1, nlohmann-json: 3.11.3

NlGHT avatar May 07 '24 13:05 NlGHT