Trait ChatCompletion

Source
pub trait ChatCompletion:
    Send
    + Sync
    + DynClone {
    // Required method
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ChatCompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn complete_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ChatCompletionRequest,
    ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream the completion response. If it’s not supported, it will return a single response

Trait Implementations§

Source§

impl ChatCompletion for &dyn ChatCompletion

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream the completion response. If it’s not supported, it will return a single response
Source§

impl ChatCompletion for Box<dyn ChatCompletion>

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream the completion response. If it’s not supported, it will return a single response
Source§

impl<LLM> From<&LLM> for Box<dyn ChatCompletion>
where LLM: ChatCompletion + Clone + 'static,

Source§

fn from(llm: &LLM) -> Self

Converts to this type from the input type.

Implementations on Foreign Types§

Source§

impl ChatCompletion for Box<dyn ChatCompletion>

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<T> ChatCompletion for &T
where T: ChatCompletion + Clone + 'static,

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, LanguageModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn complete_stream<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ChatCompletionRequest, ) -> Pin<Box<dyn Future<Output = ChatCompletionStream> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§