Skip to content

Commit 63187b9

Browse files
committed
fix: add Hugging Face inference URL to configuration and update API request URL
1 parent 72b5751 commit 63187b9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

apps/backend/.env.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ PYTHONDONTWRITEBYTECODE=1
55

66
# HuggingFace Configuration
77
USE_HUGGINGFACE=false
8-
HF_API_KEY=""
8+
HF_API_KEY=""
9+
hf_inference_url="https://api-inference.huggingface.co/models/"

apps/backend/app/agent/providers/huggingface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ def _generate_sync(self, prompt: str, options: Dict[str, Any]) -> str:
3737
"max_tokens": options.get("max_tokens", 20000),
3838
}
3939
}
40+
# Send the request to the Hugging Face Inference API
4041
response = requests.post(
41-
f"https://router.huggingface.co/hf-inference/models/{self._model_name}",
42+
f"{os.getenv('HF_INFERENCE_URL')}{self._model_name}",
4243
headers=headers,
4344
json=payload
4445
)

apps/backend/app/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Settings(BaseSettings):
1717

1818
use_huggingface: bool = False
1919
hf_api_key: Optional[str]
20+
hf_inference_url: str = "https://router.huggingface.co/hf-inference/models/"
2021

2122
model_config = SettingsConfigDict(
2223
env_file=os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, ".env"),

0 commit comments

Comments
 (0)