pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub fn from_url(
api_key: &str,
base_url: &str,
sub_provider: SubProvider,
) -> Self
pub fn from_url( api_key: &str, base_url: &str, sub_provider: SubProvider, ) -> Self
Create a new Client with the given API key and base API URL.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a new Huggingface client from the HUGGINGFACE_API_KEY environment variable.
Panics if the environment variable is not set.
Sourcepub fn completion_model(&self, model: &str) -> CompletionModel
pub fn completion_model(&self, model: &str) -> CompletionModel
Create a new completion model with the given name
§Example
use rig::providers::huggingface::{Client, self}
// Initialize the Huggingface client
let client = Client::new("your-huggingface-api-key");
let completion_model = client.completion_model(huggingface::GEMMA_2);Sourcepub fn transcription_model(&self, model: &str) -> TranscriptionModel
pub fn transcription_model(&self, model: &str) -> TranscriptionModel
Create a new transcription model with the given name
§Example
use rig::providers::huggingface::{Client, self}
// Initialize the Huggingface client
let client = Client::new("your-huggingface-api-key");
let completion_model = client.transcription_model(huggingface::WHISPER_LARGE_V3);Sourcepub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
pub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
Create an agent builder with the given completion model.
§Example
use rig::providers::huggingface::{Client, self};
// Initialize the Anthropic client
let client = Client::new("your-huggingface-api-key");
let agent = client.agent(huggingface::GEMMA_2)
.preamble("You are comedian AI with a mission to make people laugh.")
.temperature(0.0)
.build();Trait Implementations§
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> 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