pub struct HuggingFaceClient { /* private fields */ }Expand description
Implementations§
Source§impl HuggingFaceClient
impl HuggingFaceClient
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new HuggingFace client
Reads API key from HUGGINGFACE_API_KEY environment variable if available.
Falls back to mock data if no API key is provided.
Sourcepub fn with_embedding_dim(embedding_dim: usize) -> Self
pub fn with_embedding_dim(embedding_dim: usize) -> Self
Create a new HuggingFace client with custom embedding dimension
Sourcepub async fn search_models(
&self,
query: &str,
task: Option<&str>,
) -> Result<Vec<HuggingFaceModel>>
pub async fn search_models( &self, query: &str, task: Option<&str>, ) -> Result<Vec<HuggingFaceModel>>
Sourcepub async fn get_model(
&self,
model_id: &str,
) -> Result<Option<HuggingFaceModel>>
pub async fn get_model( &self, model_id: &str, ) -> Result<Option<HuggingFaceModel>>
Get detailed information about a specific model
§Arguments
model_id- Model identifier (e.g., “bert-base-uncased”)
Sourcepub async fn list_datasets(
&self,
query: Option<&str>,
) -> Result<Vec<HuggingFaceDataset>>
pub async fn list_datasets( &self, query: Option<&str>, ) -> Result<Vec<HuggingFaceDataset>>
Sourcepub async fn get_dataset(
&self,
dataset_id: &str,
) -> Result<Option<HuggingFaceDataset>>
pub async fn get_dataset( &self, dataset_id: &str, ) -> Result<Option<HuggingFaceDataset>>
Sourcepub async fn inference(
&self,
model_id: &str,
inputs: Value,
) -> Result<HuggingFaceInferenceResponse>
pub async fn inference( &self, model_id: &str, inputs: Value, ) -> Result<HuggingFaceInferenceResponse>
Sourcepub fn model_to_vector(&self, model: &HuggingFaceModel) -> SemanticVector
pub fn model_to_vector(&self, model: &HuggingFaceModel) -> SemanticVector
Convert HuggingFace model to SemanticVector
Sourcepub fn dataset_to_vector(&self, dataset: &HuggingFaceDataset) -> SemanticVector
pub fn dataset_to_vector(&self, dataset: &HuggingFaceDataset) -> SemanticVector
Convert HuggingFace dataset to SemanticVector
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HuggingFaceClient
impl !RefUnwindSafe for HuggingFaceClient
impl Send for HuggingFaceClient
impl Sync for HuggingFaceClient
impl Unpin for HuggingFaceClient
impl !UnwindSafe for HuggingFaceClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more