huggingface

package
v2.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package huggingface implements providers.EmbeddingProvider against Hugging Face's feature-extraction API: the serverless Inference Providers router (https://router.huggingface.co/hf-inference) and dedicated Inference Endpoints, which serve the same request and response shape.

Index

Constants

View Source
const (
	// DefaultBaseURL is the serverless router's hf-inference provider.
	DefaultBaseURL = "https://router.huggingface.co/hf-inference"
	// DefaultModel is a small, widely used sentence-embedding model.
	DefaultModel = "sentence-transformers/all-MiniLM-L6-v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddingOption

type EmbeddingOption func(*EmbeddingProvider)

EmbeddingOption configures the EmbeddingProvider.

func WithAPIKey

func WithAPIKey(key string) EmbeddingOption

WithAPIKey sets the Hugging Face token explicitly.

func WithDedicatedEndpoint

func WithDedicatedEndpoint() EmbeddingOption

WithDedicatedEndpoint marks BaseURL as a dedicated Inference Endpoint.

func WithWiring

WithWiring applies the transport-derived settings the factory resolved. A declared dimensions is reported and checked, but not sent: the feature-extraction API has no parameter for it.

type EmbeddingProvider

type EmbeddingProvider struct {
	*providers.BaseEmbeddingProvider
	// contains filtered or unexported fields
}

EmbeddingProvider embeds text with a Hugging Face feature-extraction model.

func NewEmbeddingProvider

func NewEmbeddingProvider(opts ...EmbeddingOption) (*EmbeddingProvider, error)

NewEmbeddingProvider creates a Hugging Face embedding provider. The model's vector size is the declared dimensions if any, otherwise the length of the first vector returned — Hugging Face hosts too many models for a lookup table to be anything but a guess.

func (*EmbeddingProvider) Embed

Embed generates embeddings for the given texts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL