Spaces:
Sleeping
Sleeping
fix: Add proper newline after HF_TOKEN check on line 13
Browse files
llm_agent_builder/templates/agent_template_hf.py.j2
CHANGED
|
@@ -10,7 +10,8 @@ class {{ agent_name }}:
|
|
| 10 |
:param api_key: Hugging Face API token. If None, will try to get from HUGGINGFACEHUB_API_TOKEN env var.
|
| 11 |
"""
|
| 12 |
if api_key is None:
|
| 13 |
-
|
|
|
|
| 14 |
raise ValueError("HUGGINGFACEHUB_API_TOKEN environment variable not set. Please set it in your .env file or environment.")
|
| 15 |
self.client = InferenceClient(token=api_key)
|
| 16 |
self.api = HfApi(token=api_key)
|
|
|
|
| 10 |
:param api_key: Hugging Face API token. If None, will try to get from HUGGINGFACEHUB_API_TOKEN env var.
|
| 11 |
"""
|
| 12 |
if api_key is None:
|
| 13 |
+
api_key = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 14 |
+
if not api_key:
|
| 15 |
raise ValueError("HUGGINGFACEHUB_API_TOKEN environment variable not set. Please set it in your .env file or environment.")
|
| 16 |
self.client = InferenceClient(token=api_key)
|
| 17 |
self.api = HfApi(token=api_key)
|