pub struct OpenAICompatibleClient { /* private fields */ }
Expand description
A client for making requests to an OpenAI compatible API.
Implementations§
Source§impl OpenAICompatibleClient
impl OpenAICompatibleClient
Sourcepub fn with_api_key(self, api_key: impl ToString) -> Self
pub fn with_api_key(self, api_key: impl ToString) -> Self
Sets the API key for the builder. (defaults to the environment variable OPENAI_API_KEY
)
The API key can be accessed from the OpenAI dashboard here.
Sourcepub fn with_base_url(self, base_url: impl ToString) -> Self
pub fn with_base_url(self, base_url: impl ToString) -> Self
Set the base URL of the API. (defaults to https://api.openai.com/v1/
)
Sourcepub fn with_organization_id(self, organization_id: impl ToString) -> Self
pub fn with_organization_id(self, organization_id: impl ToString) -> Self
Set the organization ID for the builder.
The organization ID can be accessed from the OpenAI dashboard here.
Sourcepub fn with_project_id(self, project_id: impl ToString) -> Self
pub fn with_project_id(self, project_id: impl ToString) -> Self
Set the project ID for the builder.
The project ID can be accessed from the OpenAI dashboard here.
Sourcepub fn with_reqwest_client(self, client: Client) -> Self
pub fn with_reqwest_client(self, client: Client) -> Self
Set the reqwest client for the builder.
Sourcepub fn resolve_api_key(&self) -> Result<String, NoOpenAIAPIKeyError>
pub fn resolve_api_key(&self) -> Result<String, NoOpenAIAPIKeyError>
Resolve the openai API key from the environment variable OPENAI_API_KEY
or the provided api key.
Trait Implementations§
Source§impl Clone for OpenAICompatibleClient
impl Clone for OpenAICompatibleClient
Source§fn clone(&self) -> OpenAICompatibleClient
fn clone(&self) -> OpenAICompatibleClient
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OpenAICompatibleClient
impl Debug for OpenAICompatibleClient
Auto Trait Implementations§
impl !Freeze for OpenAICompatibleClient
impl !RefUnwindSafe for OpenAICompatibleClient
impl Send for OpenAICompatibleClient
impl Sync for OpenAICompatibleClient
impl Unpin for OpenAICompatibleClient
impl !UnwindSafe for OpenAICompatibleClient
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