Skip to main content

Overview

Huggingface provides access to thousands of open-source models through their Inference API. Great for experimentation with cutting-edge models. Model Class: HuggingFaceModel

Authentication

export HF_TOKEN="hf_..."

Examples

from upsonic import Agent, Task
from upsonic.models.huggingface import HuggingFaceModel

model = HuggingFaceModel(model_name="meta-llama/Llama-3.3-70B-Instruct")
agent = Agent(model=model)

task = Task("Hello, how are you?")
result = agent.do(task)
print(result)

Parameters

ParameterTypeDescriptionDefaultSource
max_tokensintMaximum tokens to generate2048Base
temperaturefloatSampling temperature (0.0-1.0)0.7Base
top_pfloatNucleus sampling0.95Base
seedintRandom seedNoneBase
stop_sequenceslist[str]Stop sequencesNoneBase
timeoutfloatRequest timeout (seconds)600Base