When I try to run a completion, I get a 404 error. I am using API of NagaAI - https://api.naga.ac/v1. When I use NagaAI with the official Python library it doesn't make any errors.
To Reproduce
Get a prompt and a client
Run a completion
Return generated text
Code snippets
use openai_api_rs::v1::api::Client;
use openai_api_rs::v1::completion::{self, CompletionRequest, CompletionResponse};
pub fn get_completion(client: Client, prompt: &str) -> String {
let prompt_string = String::from(prompt);
let req = CompletionRequest::new(String::from("gpt-3.5-turbo"), prompt_string)
.max_tokens(3000)
.temperature(0.9)
.top_p(1.0)
.stop(vec![String::from(" Human:"), String::from(" AI:")])
.presence_penalty(0.6)
.frequency_penalty(0.0);
let result = client.completion(req).unwrap(); // Error location
result.choices[0].text.clone()
}
pub fn client(api: &str) -> Client {
let api_data = String::from(api);
const BASE_URL: &str = "https://api.naga.ac/v1";
let endpoint = std::env::var("OPENAI_API_BASE").unwrap_or_else(|_| BASE_URL.to_owned());
Client::new_with_endpoint(endpoint, api_data)
}
Describe the bug
When I try to run a completion, I get a 404 error. I am using API of NagaAI -
https://api.naga.ac/v1
. When I use NagaAI with the official Python library it doesn't make any errors.To Reproduce
Code snippets
OS
macOS
Rust version
Rust v1.75.0
Library version
openai-api-rs 4.0.8