RayMelius Claude Sonnet 4.6 commited on
Commit
e85bb16
·
1 Parent(s): f959957

Read hf_soci_token env var for HF Inference API key

Browse files

Adds hf_soci_token to the fallback chain so the HF Space secret
created under that name is picked up automatically.
Lookup order: HF_TOKEN → hf_soci_token → soci_token

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. src/soci/engine/llm.py +1 -1
src/soci/engine/llm.py CHANGED
@@ -825,7 +825,7 @@ class HFInferenceClient:
825
  default_model: str = MODEL_HF_ZEPHYR,
826
  max_retries: int = 3,
827
  ) -> None:
828
- self.api_key = api_key or os.environ.get("HF_TOKEN", "") or os.environ.get("soci_token", "")
829
  if not self.api_key:
830
  logger.warning(
831
  "Neither HF_TOKEN nor soci_token is set — HF Inference will not make LLM calls. "
 
825
  default_model: str = MODEL_HF_ZEPHYR,
826
  max_retries: int = 3,
827
  ) -> None:
828
+ self.api_key = api_key or os.environ.get("HF_TOKEN", "") or os.environ.get("hf_soci_token", "") or os.environ.get("soci_token", "")
829
  if not self.api_key:
830
  logger.warning(
831
  "Neither HF_TOKEN nor soci_token is set — HF Inference will not make LLM calls. "