Skip to main content

LlamaIndex Llms Integration: Huggingface API

Integration with Hugging Face's Inference API for generating text.

For more information on Hugging Face's Inference API, visit Hugging Face's Inference API documentation.

Installation

pip install llama-index-llms-huggingface-api

Usage

from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI

llm = HuggingFaceInferenceAPI(
    model_name="openai-community/gpt2",
    temperature=0.7,
    max_tokens=100,
    token="<your-token>",  # Optional
    provider="hf-inference",  # Optional
)

response = llm.complete("Hello, how are you?")

Metadata

Release files for llama-index-llms-huggingface-api 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-huggingface-api 0.8.0
File Size Uploaded
llama_index_llms_huggingface_api-0.8.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-huggingface-api 0.8.0
File Interpreter ABI Platform
llama_index_llms_huggingface_api-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / llama_index_llms_huggingface_api-0.8.0.tar.gz

Download URL llama_index_llms_huggingface_api-0.8.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3726caaf4fe3dd688b5f9fd64e504fdd9b3b76f3b15e5565385c6459068b259b
BLAKE2b-256 checksum
How to use checksums
1fc6b70e80dfb3bf24939ec1d44289196538e22b5acb520bdf8b4034b8946020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_huggingface_api-0.8.0-py3-none-any.whl

Download URL llama_index_llms_huggingface_api-0.8.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92cb03f58b94717f2ae5079d903fe00c4b3c1278cf049be303061bd79432271b
BLAKE2b-256 checksum
How to use checksums
72fa25dead919656782307a50c96d7871319d3cbca5f9a336df2e49fb71fde2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page