huggingface

package module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package huggingface exposes the HuggingFace Inference Router, which is OpenAI-compatible — chat completions hit /v1/chat/completions with the same request/response shape.

NewChat returns the provider-local Chat, backed by the shared OpenAI Chat Completions protocol and configured for the Hugging Face router. Callers receive tool calling and streaming without depending on OpenAI's concrete adapter type.

Index

Constants

View Source
const (
	OpenAIRequestExtensionKey     = "huggingface/openai_request"
	OpenAIResponseExtensionKey    = "huggingface/openai_response"
	OpenAIStreamChunkExtensionKey = "huggingface/openai_stream_chunk"
)
View Source
const (
	// DefaultBaseURL targets the HuggingFace router which proxies to a
	// curated set of inference providers (together, fireworks, nebius,
	// sambanova, hf-inference, ...). The router exposes an
	// OpenAI-compatible /chat/completions endpoint.
	DefaultBaseURL = "https://router.huggingface.co/v1"
)
View Source
const ModelGPTOSS120B = "openai/gpt-oss-120b"
View Source
const (
	Provider = "HuggingFace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat added in v0.13.0

type Chat = openai.ChatCompletions

Chat implements the Hugging Face router's chat endpoint.

func NewChat added in v0.13.0

func NewChat(config ChatConfig) (*Chat, error)

type ChatConfig added in v0.13.0

type ChatConfig struct {
	APIKey         string
	DefaultOptions corechat.Options
	BaseURL        string
	HTTPClient     *http.Client
}

func (ChatConfig) Validate added in v0.13.0

func (c ChatConfig) Validate() error

Jump to

Keyboard shortcuts

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