pub struct Client {
pub api_endpoint: String,
pub api_key: String,
pub organization: Option<String>,
pub proxy: Option<String>,
pub timeout: Option<u64>,
}
Fields§
§api_endpoint: String
§api_key: String
§organization: Option<String>
§proxy: Option<String>
§timeout: Option<u64>
Implementations§
Source§impl OpenAIClient
impl OpenAIClient
pub fn new(api_key: String) -> OpenAIClient
pub fn new_with_endpoint(api_endpoint: String, api_key: String) -> OpenAIClient
pub fn new_with_organization( api_key: String, organization: String, ) -> OpenAIClient
pub fn new_with_proxy(api_key: String, proxy: String) -> OpenAIClient
pub fn new_with_timeout(api_key: String, timeout: u64) -> OpenAIClient
pub async fn completion( &self, req: CompletionRequest, ) -> Result<CompletionResponse, APIError>
pub async fn edit(&self, req: EditRequest) -> Result<EditResponse, APIError>
pub async fn image_generation( &self, req: ImageGenerationRequest, ) -> Result<ImageGenerationResponse, APIError>
pub async fn image_edit( &self, req: ImageEditRequest, ) -> Result<ImageEditResponse, APIError>
pub async fn image_variation( &self, req: ImageVariationRequest, ) -> Result<ImageVariationResponse, APIError>
pub async fn embedding( &self, req: EmbeddingRequest, ) -> Result<EmbeddingResponse, APIError>
pub async fn file_list(&self) -> Result<FileListResponse, APIError>
pub async fn upload_file( &self, req: FileUploadRequest, ) -> Result<FileUploadResponse, APIError>
pub async fn delete_file( &self, req: FileDeleteRequest, ) -> Result<FileDeleteResponse, APIError>
pub async fn retrieve_file( &self, file_id: String, ) -> Result<FileRetrieveResponse, APIError>
pub async fn retrieve_file_content( &self, file_id: String, ) -> Result<Bytes, APIError>
pub async fn chat_completion( &self, req: ChatCompletionRequest, ) -> Result<ChatCompletionResponse, APIError>
pub async fn audio_transcription( &self, req: AudioTranscriptionRequest, ) -> Result<AudioTranscriptionResponse, APIError>
pub async fn audio_translation( &self, req: AudioTranslationRequest, ) -> Result<AudioTranslationResponse, APIError>
pub async fn audio_speech( &self, req: AudioSpeechRequest, ) -> Result<AudioSpeechResponse, APIError>
pub async fn create_fine_tuning_job( &self, req: CreateFineTuningJobRequest, ) -> Result<FineTuningJobObject, APIError>
pub async fn list_fine_tuning_jobs( &self, ) -> Result<FineTuningPagination<FineTuningJobObject>, APIError>
pub async fn list_fine_tuning_job_events( &self, req: ListFineTuningJobEventsRequest, ) -> Result<FineTuningPagination<FineTuningJobEvent>, APIError>
pub async fn retrieve_fine_tuning_job( &self, req: RetrieveFineTuningJobRequest, ) -> Result<FineTuningJobObject, APIError>
pub async fn cancel_fine_tuning_job( &self, req: CancelFineTuningJobRequest, ) -> Result<FineTuningJobObject, APIError>
pub async fn create_moderation( &self, req: CreateModerationRequest, ) -> Result<CreateModerationResponse, APIError>
pub async fn create_assistant( &self, req: AssistantRequest, ) -> Result<AssistantObject, APIError>
pub async fn retrieve_assistant( &self, assistant_id: String, ) -> Result<AssistantObject, APIError>
pub async fn modify_assistant( &self, assistant_id: String, req: AssistantRequest, ) -> Result<AssistantObject, APIError>
pub async fn delete_assistant( &self, assistant_id: String, ) -> Result<DeletionStatus, APIError>
pub async fn list_assistant( &self, limit: Option<i64>, order: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<ListAssistant, APIError>
pub async fn create_assistant_file( &self, assistant_id: String, req: AssistantFileRequest, ) -> Result<AssistantFileObject, APIError>
pub async fn retrieve_assistant_file( &self, assistant_id: String, file_id: String, ) -> Result<AssistantFileObject, APIError>
pub async fn delete_assistant_file( &self, assistant_id: String, file_id: String, ) -> Result<DeletionStatus, APIError>
pub async fn list_assistant_file( &self, assistant_id: String, limit: Option<i64>, order: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<ListAssistantFile, APIError>
pub async fn create_thread( &self, req: CreateThreadRequest, ) -> Result<ThreadObject, APIError>
pub async fn retrieve_thread( &self, thread_id: String, ) -> Result<ThreadObject, APIError>
pub async fn modify_thread( &self, thread_id: String, req: ModifyThreadRequest, ) -> Result<ThreadObject, APIError>
pub async fn delete_thread( &self, thread_id: String, ) -> Result<DeletionStatus, APIError>
pub async fn create_message( &self, thread_id: String, req: CreateMessageRequest, ) -> Result<MessageObject, APIError>
pub async fn retrieve_message( &self, thread_id: String, message_id: String, ) -> Result<MessageObject, APIError>
pub async fn modify_message( &self, thread_id: String, message_id: String, req: ModifyMessageRequest, ) -> Result<MessageObject, APIError>
pub async fn list_messages( &self, thread_id: String, ) -> Result<ListMessage, APIError>
pub async fn retrieve_message_file( &self, thread_id: String, message_id: String, file_id: String, ) -> Result<MessageFileObject, APIError>
pub async fn list_message_file( &self, thread_id: String, message_id: String, limit: Option<i64>, order: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<ListMessageFile, APIError>
pub async fn create_run( &self, thread_id: String, req: CreateRunRequest, ) -> Result<RunObject, APIError>
pub async fn retrieve_run( &self, thread_id: String, run_id: String, ) -> Result<RunObject, APIError>
pub async fn modify_run( &self, thread_id: String, run_id: String, req: ModifyRunRequest, ) -> Result<RunObject, APIError>
pub async fn list_run( &self, thread_id: String, limit: Option<i64>, order: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<ListRun, APIError>
pub async fn cancel_run( &self, thread_id: String, run_id: String, ) -> Result<RunObject, APIError>
pub async fn create_thread_and_run( &self, req: CreateThreadAndRunRequest, ) -> Result<RunObject, APIError>
pub async fn retrieve_run_step( &self, thread_id: String, run_id: String, step_id: String, ) -> Result<RunStepObject, APIError>
pub async fn list_run_step( &self, thread_id: String, run_id: String, limit: Option<i64>, order: Option<String>, after: Option<String>, before: Option<String>, ) -> Result<ListRunStep, APIError>
pub async fn create_batch( &self, req: CreateBatchRequest, ) -> Result<BatchResponse, APIError>
pub async fn retrieve_batch( &self, batch_id: String, ) -> Result<BatchResponse, APIError>
pub async fn cancel_batch( &self, batch_id: String, ) -> Result<BatchResponse, APIError>
pub async fn list_batch( &self, after: Option<String>, limit: Option<i64>, ) -> Result<ListBatchResponse, APIError>
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<S> AssignWithType for S
impl<S> AssignWithType for S
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<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
Source§type Val = <C as Collection>::Val
type Val = <C as Collection>::Val
The type of values stored in the collection. This might be distinct from
Entry
in complex collections.
For example, in a HashMap
, while Entry
might be a ( key, value ) tuple, Val
might only be the value part.Source§fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
Converts an entry into a value representation specific to the type of collection. This conversion is crucial
for handling operations on entries, especially when they need to be treated or accessed as individual values,
such as retrieving the value part from a key-value pair in a hash map.
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Initial, Error, Final> TransitiveTryFrom<Error, Initial> for Final
impl<Initial, Error, Final> TransitiveTryFrom<Error, Initial> for Final
Source§impl<Error, Final, Initial> TransitiveTryInto<Error, Final> for Initial
impl<Error, Final, Initial> TransitiveTryInto<Error, Final> for Initial
Source§impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
Source§fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
Invokes the val_to_entry
function of the CollectionValToEntry
trait to convert the value to an entry.
Source§type Entry = <C as CollectionValToEntry<Val>>::Entry
type Entry = <C as CollectionValToEntry<Val>>::Entry
Represents the type of entry that corresponds to the value within the collection.