CompletionProvider

Trait CompletionProvider 

Source
pub trait CompletionProvider: Send + Sync {
    type Config: ProviderConfig;
    type Response: CompletionResponse;
    type Error: ProviderError;

    // Required method
    fn complete<'life0, 'async_trait>(
        &'life0 self,
        request: CompletionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Trait for providers that support text completion (non-chat).

This is separate from ChatProvider to allow providers to implement only the capabilities they support.

Required Associated Types§

Source

type Config: ProviderConfig

Provider-specific configuration type

Source

type Response: CompletionResponse

Provider-specific response type

Source

type Error: ProviderError

Provider-specific error type

Required Methods§

Source

fn complete<'life0, 'async_trait>( &'life0 self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Complete a text prompt.

§Arguments
  • request - The completion request containing the prompt and parameters
§Returns

A result containing the completion response or an error

Implementors§