pub struct Api { /* private fields */ }Expand description
Concrete API client that talks to the remote service using reqwest.
Implementations§
Trait Implementations§
Source§impl ApiBase for Api
impl ApiBase for Api
Source§async fn get(&self, endpoint: &str) -> Result<String>
async fn get(&self, endpoint: &str) -> Result<String>
Issues a GET request and returns the full response body as
String.Source§async fn post_multipart(
&self,
endpoint: &str,
multipart: Multipart,
) -> Result<String>
async fn post_multipart( &self, endpoint: &str, multipart: Multipart, ) -> Result<String>
Issues a multipart POST request and returns the full response body as
String.Source§async fn post_json<S>(&self, endpoint: &str, body: S) -> Result<String>
async fn post_json<S>(&self, endpoint: &str, body: S) -> Result<String>
Issues a JSON POST request and returns the full response body as
String.Auto Trait Implementations§
impl !RefUnwindSafe for Api
impl !UnwindSafe for Api
impl Freeze for Api
impl Send for Api
impl Sync for Api
impl Unpin for Api
impl UnsafeUnpin for Api
Blanket Implementations§
Source§impl<T> ApiBatch for Twhere
T: ApiBase,
impl<T> ApiBatch for Twhere
T: ApiBase,
Source§fn create_batch(
&self,
request: BatchRequest,
) -> impl Send + Future<Output = Result<BatchObject>>
fn create_batch( &self, request: BatchRequest, ) -> impl Send + Future<Output = Result<BatchObject>>
Create a batch.
Source§fn retrieve_batch(
&self,
id: &str,
) -> impl Send + Future<Output = Result<BatchObject>>
fn retrieve_batch( &self, id: &str, ) -> impl Send + Future<Output = Result<BatchObject>>
Retrieve a batch by ID.
Source§impl<T> ApiChat for Twhere
T: ApiBase,
impl<T> ApiChat for Twhere
T: ApiBase,
Source§fn create_chat(
&self,
request: ChatRequest,
) -> impl Send + Future<Output = Result<ChatObject>>
fn create_chat( &self, request: ChatRequest, ) -> impl Send + Future<Output = Result<ChatObject>>
Create a chat.
Source§fn create_chat_stream<H>(
&self,
request: ChatRequest,
options: SseOptions<H>,
) -> impl Send + Future<Output = Result<Pin<Box<dyn Send + Stream<Item = Result<H::Event>>>>>>where
H: 'static + EventHandler,
fn create_chat_stream<H>(
&self,
request: ChatRequest,
options: SseOptions<H>,
) -> impl Send + Future<Output = Result<Pin<Box<dyn Send + Stream<Item = Result<H::Event>>>>>>where
H: 'static + EventHandler,
Create a chat with streaming.
Source§impl<T> ApiEmbedding for Twhere
T: ApiBase,
impl<T> ApiEmbedding for Twhere
T: ApiBase,
Source§fn create_embedding(
&self,
request: EmbeddingRequest,
) -> impl Send + Future<Output = Result<EmbeddingResponse>>
fn create_embedding( &self, request: EmbeddingRequest, ) -> impl Send + Future<Output = Result<EmbeddingResponse>>
Create an embedding.
Source§impl<T> ApiResponse for Twhere
T: ApiBase,
impl<T> ApiResponse for Twhere
T: ApiBase,
Source§fn create_response(
&self,
request: ResponseRequest,
) -> impl Send + Future<Output = Result<ResponseObject>>
fn create_response( &self, request: ResponseRequest, ) -> impl Send + Future<Output = Result<ResponseObject>>
Create a response (non-streaming).
Source§fn create_response_stream<H>(
&self,
request: ResponseRequest,
options: SseOptions<H>,
) -> impl Send + Future<Output = Result<Pin<Box<dyn Send + Stream<Item = Result<H::Event>>>>>>where
H: 'static + EventHandler,
fn create_response_stream<H>(
&self,
request: ResponseRequest,
options: SseOptions<H>,
) -> impl Send + Future<Output = Result<Pin<Box<dyn Send + Stream<Item = Result<H::Event>>>>>>where
H: 'static + EventHandler,
Create a response with streaming.
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