Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files
README.md
CHANGED
|
@@ -35,22 +35,26 @@ itself.
|
|
| 35 |
|
| 36 |
To run it (locally or as a Space), set the `HF_TOKEN` secret/env var to a
|
| 37 |
Hugging Face access token with Inference API permission. Optionally set
|
| 38 |
-
`HF_AGENT_MODEL` to override the default model
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
The default
|
| 49 |
-
includes $0.10/month of Inference Provider credits, and a 70B
|
| 50 |
-
through that
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
### Using Claude instead
|
| 56 |
|
|
|
|
| 35 |
|
| 36 |
To run it (locally or as a Space), set the `HF_TOKEN` secret/env var to a
|
| 37 |
Hugging Face access token with Inference API permission. Optionally set
|
| 38 |
+
`HF_AGENT_MODEL` to override the default model (`Qwen/Qwen3-14B`), and
|
| 39 |
+
`HF_AGENT_PROVIDER` to override the default Inference Provider (`nscale`) —
|
| 40 |
+
pinned explicitly because the router's `auto` selection can land on a
|
| 41 |
+
provider that doesn't support tool calling for a given model (HTTP 422
|
| 42 |
+
`UNSUPPORTED_OPENAI_PARAMS`), and not every provider hosts every model (HTTP
|
| 43 |
+
4xx "Model ... is not supported by provider ..."). Check
|
| 44 |
+
`https://router.huggingface.co/v1/models/<repo_id>` to see which providers
|
| 45 |
+
host a given model and whether they support tools before changing either
|
| 46 |
+
variable.
|
| 47 |
|
| 48 |
+
The default model is a budget pick, not a maximal-accuracy one: the HF free
|
| 49 |
+
tier only includes $0.10/month of Inference Provider credits, and a 70B+
|
| 50 |
+
model burns through that in a couple of questions. `Qwen/Qwen3-14B` on
|
| 51 |
+
`nscale` costs only a few cents for a full ~20-question GAIA run while
|
| 52 |
+
reasoning noticeably better than the 8B model it replaced. For an even
|
| 53 |
+
smaller footprint (more runs per month out of the free allowance), set
|
| 54 |
+
`HF_AGENT_MODEL=meta-llama/Llama-3.1-8B-Instruct` and
|
| 55 |
+
`HF_AGENT_PROVIDER=deepinfra`. If you have real budget (pre-paid credits or
|
| 56 |
+
PRO), go bigger with something like `meta-llama/Llama-3.3-70B-Instruct` on
|
| 57 |
+
`together` for more reliable reasoning on harder questions.
|
| 58 |
|
| 59 |
### Using Claude instead
|
| 60 |
|
agent.py
CHANGED
|
@@ -34,18 +34,20 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 34 |
LLM_PROVIDER = os.getenv("LLM_PROVIDER", "huggingface")
|
| 35 |
|
| 36 |
# Any HF Inference API model that supports tool calling works here. Override via the
|
| 37 |
-
# HF_AGENT_MODEL env var without touching code.
|
| 38 |
-
#
|
| 39 |
-
# Inference Provider credit allowance
|
| 40 |
-
#
|
| 41 |
-
#
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# Left unset ("auto"), the HF router picks whichever provider is cheapest/fastest for the
|
| 45 |
# model, and some of those don't support the `tools` param at all (HTTP 422
|
| 46 |
# UNSUPPORTED_OPENAI_PARAMS). Pin one that reliably supports tool calling; override via
|
| 47 |
# HF_AGENT_PROVIDER if it doesn't happen to host HF_AGENT_MODEL.
|
| 48 |
-
HF_MODEL_PROVIDER = os.getenv("HF_AGENT_PROVIDER", "
|
| 49 |
|
| 50 |
# Cheapest current Claude model - a good fit for an agent that makes many tool-calling
|
| 51 |
# round trips per question. Override via ANTHROPIC_MODEL (e.g. "claude-sonnet-5" for
|
|
|
|
| 34 |
LLM_PROVIDER = os.getenv("LLM_PROVIDER", "huggingface")
|
| 35 |
|
| 36 |
# Any HF Inference API model that supports tool calling works here. Override via the
|
| 37 |
+
# HF_AGENT_MODEL env var without touching code. Qwen3-14B gives noticeably better reasoning
|
| 38 |
+
# than the 8B model it replaced (meta-llama/Llama-3.1-8B-Instruct) for a modest bite out of
|
| 39 |
+
# the free tier's tiny $0.10/month Inference Provider credit allowance - on the "nscale"
|
| 40 |
+
# provider below, a full ~20-question GAIA run costs only a few cents. Drop back to
|
| 41 |
+
# Llama-3.1-8B-Instruct (paired with the "deepinfra" provider) if you need more runs per
|
| 42 |
+
# month out of the free allowance, or go bigger (e.g. meta-llama/Llama-3.3-70B-Instruct on
|
| 43 |
+
# "together") once you have paid credits.
|
| 44 |
+
HF_MODEL_REPO_ID = os.getenv("HF_AGENT_MODEL", "Qwen/Qwen3-14B")
|
| 45 |
|
| 46 |
# Left unset ("auto"), the HF router picks whichever provider is cheapest/fastest for the
|
| 47 |
# model, and some of those don't support the `tools` param at all (HTTP 422
|
| 48 |
# UNSUPPORTED_OPENAI_PARAMS). Pin one that reliably supports tool calling; override via
|
| 49 |
# HF_AGENT_PROVIDER if it doesn't happen to host HF_AGENT_MODEL.
|
| 50 |
+
HF_MODEL_PROVIDER = os.getenv("HF_AGENT_PROVIDER", "nscale")
|
| 51 |
|
| 52 |
# Cheapest current Claude model - a good fit for an agent that makes many tool-calling
|
| 53 |
# round trips per question. Override via ANTHROPIC_MODEL (e.g. "claude-sonnet-5" for
|