pub struct ClientBuilder {
pub base_url: Option<Url>,
pub authenticator: Option<Box<dyn AuthenticatorTrait>>,
}
Expand description
Client builder
use openai_ng::prelude::*;
let builder = Client::builder();
let client = builder
.with_base_url("https://api.openai.com")?
.with_version("v1")?
.with_key("you client key")?
.build()?;
Fields§
§base_url: Option<Url>
§authenticator: Option<Box<dyn AuthenticatorTrait>>
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn with_base_url(self, base_url: impl AsRef<str>) -> Result<Self>
pub fn with_base_url(self, base_url: impl AsRef<str>) -> Result<Self>
config base_url
Sourcepub fn with_version(self, version: impl AsRef<str>) -> Result<Self>
pub fn with_version(self, version: impl AsRef<str>) -> Result<Self>
config version
Sourcepub fn with_key(self, key: impl AsRef<str>) -> Result<Self>
pub fn with_key(self, key: impl AsRef<str>) -> Result<Self>
config bearer authenticator with key
Sourcepub fn with_authenticator(
self,
authenticator: impl AuthenticatorTrait + 'static,
) -> Result<Self>
pub fn with_authenticator( self, authenticator: impl AuthenticatorTrait + 'static, ) -> Result<Self>
config authenticator with custom authenticator
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl !Send for ClientBuilder
impl !Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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