This pull request reroutes all previously programmed interactions with the API to a new openai_request() function which handles errors returned by the API. A program using the library after this PR is merged could handle errors like so:
let completion = Completion::new(&CreateCompletionRequestBody {
model: ModelID::TextDavinci003,
prompt: "Say this is a test",
max_tokens: Some(7),
temperature: Some(0.0),
..Default::default()
})
.await
.expect("request should complete successfully")
.expect("API should not respond with an error");
This pull request reroutes all previously programmed interactions with the API to a new
openai_request()
function which handles errors returned by the API. A program using the library after this PR is merged could handle errors like so: