diff --git a/.env.sample b/.env.sample index 00826f4b..1ca31651 100644 --- a/.env.sample +++ b/.env.sample @@ -18,7 +18,7 @@ GOOGLE_REGION= GOOGLE_PROJECT_ID= # Hugging Face token -HUGGINGFACE_TOKEN= +HF_TOKEN= # Fireworks FIREWORKS_API_KEY= diff --git a/aisuite/providers/huggingface_provider.py b/aisuite/providers/huggingface_provider.py index 5a1bb902..de989f7d 100644 --- a/aisuite/providers/huggingface_provider.py +++ b/aisuite/providers/huggingface_provider.py @@ -19,10 +19,10 @@ def __init__(self, **config): The token is fetched from the config or environment variables. """ # Ensure API key is provided either in config or via environment variable - self.token = config.get("token") or os.getenv("HUGGINGFACE_TOKEN") + self.token = config.get("token") or os.getenv("HF_TOKEN") if not self.token: raise ValueError( - "Hugging Face token is missing. Please provide it in the config or set the HUGGINGFACE_TOKEN environment variable." + "Hugging Face token is missing. Please provide it in the config or set the HF_TOKEN environment variable." ) # Optionally set a custom timeout (default to 30s) diff --git a/guides/huggingface.md b/guides/huggingface.md index 11bd9297..840c3925 100644 --- a/guides/huggingface.md +++ b/guides/huggingface.md @@ -18,7 +18,7 @@ After setting up your model, you'll need to gather the following information: Set the following environment variables to make authentication and requests easy: ```shell -export HUGGINGFACE_TOKEN="your-api-token" +export HF_TOKEN="your-api-token" ``` ## Create a Chat Completion