Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
README.md
CHANGED
|
@@ -36,11 +36,18 @@ itself.
|
|
| 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 |
-
(`meta-llama/Llama-3.
|
| 40 |
-
default Inference Provider (`
|
| 41 |
router's `auto` selection can land on a provider that doesn't support tool
|
| 42 |
calling for a given model (HTTP 422 `UNSUPPORTED_OPENAI_PARAMS`), and not every
|
| 43 |
provider hosts every model (HTTP 4xx "Model ... is not supported by provider
|
| 44 |
..."). Check `https://router.huggingface.co/v1/models/<repo_id>` to see which
|
| 45 |
providers host a given model and whether they support tools before changing
|
| 46 |
-
either variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
(`meta-llama/Llama-3.1-8B-Instruct`), and `HF_AGENT_PROVIDER` to override the
|
| 40 |
+
default Inference Provider (`deepinfra`) — pinned explicitly because the
|
| 41 |
router's `auto` selection can land on a provider that doesn't support tool
|
| 42 |
calling for a given model (HTTP 422 `UNSUPPORTED_OPENAI_PARAMS`), and not every
|
| 43 |
provider hosts every model (HTTP 4xx "Model ... is not supported by provider
|
| 44 |
..."). Check `https://router.huggingface.co/v1/models/<repo_id>` to see which
|
| 45 |
providers host a given model and whether they support tools before changing
|
| 46 |
+
either variable.
|
| 47 |
+
|
| 48 |
+
The default 8B model was chosen for cost, not accuracy: the HF free tier only
|
| 49 |
+
includes $0.10/month of Inference Provider credits, and a 70B model burns
|
| 50 |
+
through that almost instantly across a full GAIA run. If you have more budget
|
| 51 |
+
(pre-paid credits or PRO), switch to a larger model such as
|
| 52 |
+
`meta-llama/Llama-3.3-70B-Instruct` on the `together` provider for more
|
| 53 |
+
reliable reasoning on harder questions.
|
agent.py
CHANGED
|
@@ -29,14 +29,18 @@ from langgraph.prebuilt import ToolNode, tools_condition
|
|
| 29 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 30 |
|
| 31 |
# Any HF Inference API model that supports tool calling works here. Override via the
|
| 32 |
-
# HF_AGENT_MODEL env var without touching code.
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# Left unset ("auto"), the HF router picks whichever provider is cheapest/fastest for the
|
| 36 |
# model, and some of those don't support the `tools` param at all (HTTP 422
|
| 37 |
# UNSUPPORTED_OPENAI_PARAMS). Pin one that reliably supports tool calling; override via
|
| 38 |
# HF_AGENT_PROVIDER if it doesn't happen to host HF_AGENT_MODEL.
|
| 39 |
-
HF_MODEL_PROVIDER = os.getenv("HF_AGENT_PROVIDER", "
|
| 40 |
|
| 41 |
with open(Path(__file__).parent / "system_prompt.txt", "r", encoding="utf-8") as f:
|
| 42 |
SYSTEM_PROMPT = f.read()
|
|
|
|
| 29 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 30 |
|
| 31 |
# Any HF Inference API model that supports tool calling works here. Override via the
|
| 32 |
+
# HF_AGENT_MODEL env var without touching code. Llama-3.1-8B-Instruct is ~15x cheaper per
|
| 33 |
+
# token than the 70B default it replaced - picked to fit the free tier's tiny $0.10/month
|
| 34 |
+
# Inference Provider credit allowance; swap to a larger model (e.g.
|
| 35 |
+
# meta-llama/Llama-3.3-70B-Instruct on the "together" provider) once you have more budget
|
| 36 |
+
# for better reasoning on harder GAIA questions.
|
| 37 |
+
HF_MODEL_REPO_ID = os.getenv("HF_AGENT_MODEL", "meta-llama/Llama-3.1-8B-Instruct")
|
| 38 |
|
| 39 |
# Left unset ("auto"), the HF router picks whichever provider is cheapest/fastest for the
|
| 40 |
# model, and some of those don't support the `tools` param at all (HTTP 422
|
| 41 |
# UNSUPPORTED_OPENAI_PARAMS). Pin one that reliably supports tool calling; override via
|
| 42 |
# HF_AGENT_PROVIDER if it doesn't happen to host HF_AGENT_MODEL.
|
| 43 |
+
HF_MODEL_PROVIDER = os.getenv("HF_AGENT_PROVIDER", "deepinfra")
|
| 44 |
|
| 45 |
with open(Path(__file__).parent / "system_prompt.txt", "r", encoding="utf-8") as f:
|
| 46 |
SYSTEM_PROMPT = f.read()
|