Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    type Error: Error + 'static;

    // Required method
    fn post(
        &self,
        req: HttpRequest,
    ) -> impl Future<Output = Result<HttpResponse, Self::Error>>;
}
Expand description

Implement this trait to provide an HTTP backend.

Only POST is required because every LLM provider API uses POST for inference. If you need other methods (e.g. GET for model listing), extend this trait in your own provider code.

Required Associated Types§

Source

type Error: Error + 'static

Required Methods§

Source

fn post( &self, req: HttpRequest, ) -> impl Future<Output = Result<HttpResponse, Self::Error>>

Send an HTTP POST request and return the response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§