pub struct Client { /* private fields */ }
Expand description
Client object. Must be constructed to talk to the API.
Implementations§
Source§impl Client
impl Client
pub fn new(token: &str) -> Self
Sourcepub async fn engines(&self) -> Result<Vec<EngineInfo>, Error>
pub async fn engines(&self) -> Result<Vec<EngineInfo>, Error>
Lists the currently available engines.
Provides basic information about each one such as the owner and availability.
§Errors
Error::APIError
if the server returns an error
Sourcepub async fn engine(&self, engine: &str) -> Result<EngineInfo, Error>
pub async fn engine(&self, engine: &str) -> Result<EngineInfo, Error>
Retrieves an engine instance
Provides basic information about the engine such as the owner and availability.
§Errors
Error::APIError
if the server returns an error
Sourcepub fn build_url_from_path(&self, path: &str) -> String
pub fn build_url_from_path(&self, path: &str) -> String
Build an OpenAI API url from a relative path
Sourcepub async fn complete_prompt(
&self,
prompt: impl Into<CompletionArgs>,
) -> Result<Completion, Error>
pub async fn complete_prompt( &self, prompt: impl Into<CompletionArgs>, ) -> Result<Completion, Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more