pub struct OpenAIClient { /* private fields */ }Implementations§
Source§impl OpenAIClient
impl OpenAIClient
pub fn new_with_headers( base_url: String, api_key: String, models_path: String, chat_path: String, custom_headers: HashMap<String, String>, ) -> Self
pub fn new_with_provider_config( base_url: String, api_key: String, models_path: String, chat_path: String, custom_headers: HashMap<String, String>, provider_config: ProviderConfig, ) -> Self
pub async fn chat(&self, request: &ChatRequest) -> Result<String>
pub async fn list_models(&self) -> Result<Vec<Model>>
pub async fn chat_with_tools( &self, request: &ChatRequest, ) -> Result<ChatResponse>
pub async fn get_token_from_url(&self, token_url: &str) -> Result<TokenResponse>
pub async fn embeddings( &self, request: &EmbeddingRequest, ) -> Result<EmbeddingResponse>
pub async fn generate_images( &self, request: &ImageGenerationRequest, ) -> Result<ImageGenerationResponse>
pub async fn chat_stream(&self, request: &ChatRequest) -> Result<()>
Auto Trait Implementations§
impl Freeze for OpenAIClient
impl !RefUnwindSafe for OpenAIClient
impl Send for OpenAIClient
impl Sync for OpenAIClient
impl Unpin for OpenAIClient
impl !UnwindSafe for OpenAIClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.