pub struct PerplexityAdapter { /* private fields */ }
Expand description
Perplexity API adapter
Perplexity provides search-enhanced AI with a custom API format. Documentation: https://docs.perplexity.ai/getting-started/overview
Implementations§
Source§impl PerplexityAdapter
impl PerplexityAdapter
pub fn new() -> Result<Self, AiLibError>
pub async fn chat_completion( &self, request: ChatCompletionRequest, ) -> Result<ChatCompletionResponse, AiLibError>
pub async fn chat_completion_stream( &self, request: ChatCompletionRequest, ) -> Result<Box<dyn Stream<Item = Result<ChatCompletionChunk, AiLibError>> + Send + Unpin>, AiLibError>
Trait Implementations§
Source§impl ChatApi for PerplexityAdapter
impl ChatApi for PerplexityAdapter
Source§fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatCompletionResponse, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send chat completion request Read more
Source§fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<ChatCompletionChunk, AiLibError>> + Send + Unpin>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatCompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<ChatCompletionChunk, AiLibError>> + Send + Unpin>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Streaming chat completion request Read more
Source§fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_models<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get list of supported models Read more
Source§fn get_model_info<'life0, 'life1, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ModelInfo, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_model_info<'life0, 'life1, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ModelInfo, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get model information Read more
Source§fn chat_completion_batch<'life0, 'async_trait>(
&'life0 self,
requests: Vec<ChatCompletionRequest>,
concurrency_limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<ChatCompletionResponse, AiLibError>>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion_batch<'life0, 'async_trait>(
&'life0 self,
requests: Vec<ChatCompletionRequest>,
concurrency_limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<ChatCompletionResponse, AiLibError>>, AiLibError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Batch chat completion requests Read more
Auto Trait Implementations§
impl Freeze for PerplexityAdapter
impl !RefUnwindSafe for PerplexityAdapter
impl Send for PerplexityAdapter
impl Sync for PerplexityAdapter
impl Unpin for PerplexityAdapter
impl !UnwindSafe for PerplexityAdapter
Blanket Implementations§
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