pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder(api_key: &str) -> ClientBuilder<'_>
pub fn builder(api_key: &str) -> ClientBuilder<'_>
Create a new Perplexity client builder.
§Example
use rig::providers::perplexity::{ClientBuilder, self};
// Initialize the Perplexity client
let perplexity = Client::builder("your-perplexity-api-key")
.build()
Sourcepub fn new(api_key: &str) -> Self
pub fn new(api_key: &str) -> Self
Create a new Perplexity client. For more control, use the builder
method.
§Panics
- If the reqwest client cannot be built (if the TLS backend cannot be initialized).
pub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
pub fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>( &self, model: &str, ) -> ExtractorBuilder<T, CompletionModel>
Trait Implementations§
Source§impl AsEmbeddings for Client
impl AsEmbeddings for Client
fn as_embeddings(&self) -> Option<Box<dyn EmbeddingsClientDyn>>
Source§impl AsTranscription for Client
impl AsTranscription for Client
fn as_transcription(&self) -> Option<Box<dyn TranscriptionClientDyn>>
Source§impl CompletionClient for Client
impl CompletionClient for Client
Source§type CompletionModel = CompletionModel
type CompletionModel = CompletionModel
The type of CompletionModel used by the client.
Source§fn completion_model(&self, model: &str) -> CompletionModel
fn completion_model(&self, model: &str) -> CompletionModel
Create a completion model with the given name. Read more
Source§fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: &str) -> AgentBuilder<Self::CompletionModel>
Create an agent builder with the given completion model. Read more
Source§fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>(
&self,
model: &str,
) -> ExtractorBuilder<T, Self::CompletionModel>
fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>( &self, model: &str, ) -> ExtractorBuilder<T, Self::CompletionModel>
Create an extractor builder with the given completion model.
Source§impl ProviderClient for Client
impl ProviderClient for Client
Source§fn from_env() -> Self
fn from_env() -> Self
Create a new Perplexity client from the PERPLEXITY_API_KEY
environment variable.
Panics if the environment variable is not set.
fn from_val(input: ProviderValue) -> Self
Source§fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
fn boxed(self) -> Box<dyn ProviderClient>where
Self: Sized + 'static,
A helper method to box the client.
Source§fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
fn from_env_boxed<'a>() -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
Create a boxed client from the process’s environment.
Panics if an environment is improperly configured.
Source§fn from_val_boxed<'a>(input: ProviderValue) -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
fn from_val_boxed<'a>(input: ProviderValue) -> Box<dyn ProviderClient + 'a>where
Self: Sized + 'a,
Create a boxed client from the process’s environment.
Panics if an environment is improperly configured.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
impl<T> AsCompletion for Twhere
T: CompletionClientDyn + Clone + 'static,
fn as_completion(&self) -> Option<Box<dyn CompletionClientDyn>>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
impl<T, M, R> CompletionClientDyn for Twhere
T: CompletionClient<CompletionModel = M>,
M: CompletionModel<StreamingResponse = R> + 'static,
R: Clone + Unpin + GetTokenUsage + 'static,
Source§fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
fn completion_model<'a>(&self, model: &str) -> Box<dyn CompletionModelDyn + 'a>
Create a completion model with the given name.
Source§fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
fn agent<'a>(&self, model: &str) -> AgentBuilder<CompletionModelHandle<'a>>
Create an agent builder with the given completion model.