Skip to main content

HuggingFaceExt

Struct HuggingFaceExt 

Source
pub struct HuggingFaceExt { /* private fields */ }

Trait Implementations§

Source§

impl<H> Capabilities<H> for HuggingFaceExt

Source§

type Completion = Capable<GenericCompletionModel<HuggingFaceExt, H>>

Completion model capability marker.
Source§

type Embeddings = Nothing

Embedding model capability marker.
Source§

type Transcription = Capable<TranscriptionModel<H>>

Audio transcription model capability marker.
Source§

type ModelListing = Nothing

Model listing capability marker.
Source§

type ImageGeneration = Capable<ImageGenerationModel<H>>

Available on crate feature image only.
Image generation model capability marker.
Source§

type AudioGeneration = Nothing

Available on crate feature audio only.
Audio generation model capability marker.
Source§

type Rerank = Nothing

Rerank model capability marker.
Source§

impl Clone for HuggingFaceExt

Source§

fn clone(&self) -> HuggingFaceExt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HuggingFaceExt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DebugExt for HuggingFaceExt

Source§

fn fields(&self) -> impl Iterator<Item = (&'static str, &dyn Debug)>

Additional provider-specific fields to include in Client debug output.
Source§

impl Default for HuggingFaceExt

Source§

fn default() -> HuggingFaceExt

Returns the “default value” for a type. Read more
Source§

impl OpenAICompatibleProvider for HuggingFaceExt

Source§

const PROVIDER_NAME: &'static str = "huggingface"

Provider name recorded on gen_ai.provider.name telemetry spans.
Source§

const SUPPORTS_RESPONSE_FORMAT: bool = false

Whether output_schema maps to OpenAI’s response_format. Providers whose APIs reject json_schema response formats set this to false; the schema is then dropped with a warning instead of being sent.
Source§

type StreamingUsage = Usage

The usage payload parsed from streaming chunks and carried on the final streaming response. OpenAI’s Usage for most providers; providers with richer usage accounting (e.g. Mistral’s cached-token fallbacks, DeepSeek’s cache hit/miss counters) substitute their own.
Source§

type Response = CompletionResponse

The chat-completions payload this provider returns.
Source§

fn completion_path(&self, _model: &str) -> String

The request path for chat completions, resolved against the client base URL by Provider::build_uri. Providers that route the model through the URL (e.g. Azure deployment paths) or keep other capabilities on differently-versioned paths override this. model is the identifier the completion model handle was created with; per-request model overrides only affect the body.
Source§

fn prepare_request( &self, request: &mut CompletionRequest, ) -> Result<(), CompletionError>

Adjust the typed request before serialization (e.g. rewrite the model identifier or fold provider-native tool definitions out of additional_params).
Source§

const EMITS_COMPLETE_SINGLE_CHUNK_TOOL_CALLS: bool = false

Whether the backend can emit a whole tool call (id, name, and complete arguments) in a single streaming chunk, as llama.cpp-based servers do. When true, the shared streaming layer emits such calls as soon as they arrive instead of holding them until the stream ends.
Source§

const SUPPORTS_TOOLS: bool = true

Whether the provider supports tool calling. When false, tools and tool_choice are dropped with a warning during request conversion — before tool-choice validation, so unsupported tool configurations never error client-side on a provider that ignores tools anyway.
Source§

const STREAM_INCLUDE_USAGE: bool = true

Whether streaming requests include "stream_options": {"include_usage": true}. Providers that reject unknown parameters and already report usage on the final chunk set this to false.
Source§

fn build_completion_request( &self, model: String, request: CoreCompletionRequest, options: CompletionModelOptions, ) -> Result<CompletionRequest, CompletionError>

Build the typed chat-completions request. Providers that share the OpenAI transport but need provider-specific message conversion can override this while still using GenericCompletionModel for sending, streaming, error handling, and telemetry.
Source§

fn finalize_request_body(&self, body: &mut Value) -> Result<(), CompletionError>

Adjust the fully serialized request body — after any streaming parameters are merged — immediately before it is sent. This is where wire-level dialect differences live (e.g. Mistral’s "any" tool choice, DeepSeek’s string-flattened message content).
Source§

fn finalize_request_body_with_options( &self, body: &mut Value, options: CompletionModelOptions, ) -> Result<(), CompletionError>

Adjust the fully serialized request body with model-level options. Providers that do not need model-instance options should override finalize_request_body instead.
Source§

fn decorate_streaming_tool_call( &self, detail: &Value, tool_calls: &mut HashMap<usize, RawStreamingToolCall>, )

Decorate streamed tool calls from provider-specific streaming detail payloads. Most OpenAI-compatible providers do not emit such details.
Source§

impl Provider for HuggingFaceExt

Source§

const VERIFY_PATH: &'static str = "/api/whoami-v2"

Provider endpoint used by VerifyClient to validate credentials.
Source§

type Builder = HuggingFaceBuilder

The builder type that constructs this provider extension. This associates extensions with their builders for type inference.
Source§

fn build_uri(&self, base_url: &str, path: &str, _transport: Transport) -> String

Build a complete request URI for the given base URL, provider path, and transport.
Source§

fn with_custom(&self, req: Builder) -> Result<Builder>

Apply provider-specific request customization before sending.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneDebuggableStorage for T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CloneableStorage for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> DebuggableStorage for T
where T: Any + Send + Sync + Debug,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more