Trait JsonRequest

Source
pub trait JsonRequest<TRes: DeserializeOwned>:
    Serialize
    + Sized
    + Sync {
    const ENDPOINT: &'static str;

    // Provided method
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 OpenAiClient,
    ) -> Pin<Box<dyn Future<Output = Result<TRes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Associated Constants§

Source

const ENDPOINT: &'static str

Provided Methods§

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 OpenAiClient, ) -> Pin<Box<dyn Future<Output = Result<TRes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl JsonRequest<ChatSuccess> for ChatRequest

Source§

const ENDPOINT: &'static str = "/chat/completions"

Source§

impl JsonRequest<CompletionSuccess> for CompletionRequest

Source§

const ENDPOINT: &'static str = "/completions"

Source§

impl JsonRequest<EditResponse> for EditRequest

Source§

const ENDPOINT: &'static str = "/edits"

Source§

impl JsonRequest<EmbeddingResponse> for EmbeddingRequest

Source§

const ENDPOINT: &'static str = "/embeddings"

Source§

impl JsonRequest<FineTune> for FineTuneCreateRequest

Source§

const ENDPOINT: &'static str = "/fine-tunes"

Source§

impl JsonRequest<ImageResponse> for ImageRequest

Source§

const ENDPOINT: &'static str = "/images/generations"

Source§

impl JsonRequest<ModerationResponse> for ModerationRequest

Source§

const ENDPOINT: &'static str = "/moderations"