Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- app.py +6 -0
- matchday/agent.py +8 -0
- matchday/prompts.py +9 -0
- matchday/trip_tool.py +6 -0
app.py
CHANGED
|
@@ -11,6 +11,12 @@ Brain + Hands: Nemotron (on Modal) never calls an API or names a price; Python
|
|
| 11 |
executes every call and scores every value. Every figure carries provenance.
|
| 12 |
|
| 13 |
The gr.Blocks streaming version is retained at ``matchday/app.py`` as a fallback.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"""
|
| 15 |
from __future__ import annotations
|
| 16 |
|
|
|
|
| 11 |
executes every call and scores every value. Every figure carries provenance.
|
| 12 |
|
| 13 |
The gr.Blocks streaming version is retained at ``matchday/app.py`` as a fallback.
|
| 14 |
+
|
| 15 |
+
Reference patterns (3-codebase study, see MATCHDAY_UNCONSTRAINED_PLAN.md):
|
| 16 |
+
- N1 gradio.Server custom-frontend architecture (Off-Brand badge):
|
| 17 |
+
https://huggingface.co/blog/introducing-gradio-server ("Why @app.api()…").
|
| 18 |
+
- N35 preflight gate (fail-fast on missing SerpApi key): Claude Code
|
| 19 |
+
utils/preflightChecks.tsx:1-60.
|
| 20 |
"""
|
| 21 |
from __future__ import annotations
|
| 22 |
|
matchday/agent.py
CHANGED
|
@@ -12,6 +12,14 @@ class parses. Nemotron decides; Python executes (Brain + Hands).
|
|
| 12 |
|
| 13 |
Requires the Modal app to be deployed (``modal deploy matchday/modal_spike.py``)
|
| 14 |
so ``Server().generate.remote()`` resolves from any client.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"""
|
| 16 |
from __future__ import annotations
|
| 17 |
|
|
|
|
| 12 |
|
| 13 |
Requires the Modal app to be deployed (``modal deploy matchday/modal_spike.py``)
|
| 14 |
so ``Server().generate.remote()`` resolves from any client.
|
| 15 |
+
|
| 16 |
+
Reference patterns (3-codebase study, see MATCHDAY_UNCONSTRAINED_PLAN.md):
|
| 17 |
+
- N2/N4 streaming client — SSE parsing + reasoning/content split + Modal-Session-ID
|
| 18 |
+
sticky routing adapted from modal-labs/modal-examples nemotron_inference.py
|
| 19 |
+
(`_send_request_streaming` SSE parser ~L330-380; Modal-Session-ID ~L340-350).
|
| 20 |
+
- N29 error classification — hermes-agent error_classifier.py + Claude Code
|
| 21 |
+
services/api/errors.ts classifyAPIError (a cold-start timeout is re-tagged
|
| 22 |
+
MODEL_COLD_START here, not the generic NETWORK_TIMEOUT).
|
| 23 |
"""
|
| 24 |
from __future__ import annotations
|
| 25 |
|
matchday/prompts.py
CHANGED
|
@@ -12,6 +12,15 @@ the persona + behavior + decision guidance — never the tool JSON schemas.
|
|
| 12 |
Brain + Hands: Nemotron picks tools, reasons, explains. Python executes every
|
| 13 |
tool and scores every price. Nemotron NEVER calls an API, names a price, or
|
| 14 |
invents a flight number / weather reading — it calls a tool.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"""
|
| 16 |
from __future__ import annotations
|
| 17 |
|
|
|
|
| 12 |
Brain + Hands: Nemotron picks tools, reasons, explains. Python executes every
|
| 13 |
tool and scores every price. Nemotron NEVER calls an API, names a price, or
|
| 14 |
invents a flight number / weather reading — it calls a tool.
|
| 15 |
+
|
| 16 |
+
Reference patterns (3-codebase study, see MATCHDAY_UNCONSTRAINED_PLAN.md):
|
| 17 |
+
- N22 behavior preset (no preamble; understand→act→verify; "first attempt
|
| 18 |
+
rarely correct"; disagree respectfully; don't stop partway): deepagents-main
|
| 19 |
+
/deepagents/graph.py:50-91 (BASE_AGENT_PROMPT).
|
| 20 |
+
- N28/K7 byte-stable prompt prefix (date-only timestamp; stable persona/context
|
| 21 |
+
tier at the prefix, volatile date tier at the suffix for KV-cache reuse):
|
| 22 |
+
deepagents system_prompt.py:329-337,353-369 + graph.py:584-600.
|
| 23 |
+
- A3 tool-use guidance: deepagents + Claude Code tool-description conventions.
|
| 24 |
"""
|
| 25 |
from __future__ import annotations
|
| 26 |
|
matchday/trip_tool.py
CHANGED
|
@@ -22,6 +22,12 @@ to ``format_for_nemotron`` for compact serialisation.
|
|
| 22 |
|
| 23 |
``TripPackageResult`` is the structured return type, carrying the scored
|
| 24 |
packages, a status enum, degradation notices, and provenance metadata.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"""
|
| 26 |
|
| 27 |
from __future__ import annotations
|
|
|
|
| 22 |
|
| 23 |
``TripPackageResult`` is the structured return type, carrying the scored
|
| 24 |
packages, a status enum, degradation notices, and provenance metadata.
|
| 25 |
+
|
| 26 |
+
Reference patterns (3-codebase study, see MATCHDAY_UNCONSTRAINED_PLAN.md):
|
| 27 |
+
- Compact tool-result serialization (``format_for_nemotron``): hermes-agent-main
|
| 28 |
+
/agent/tool_dispatch_helpers.py:320-397 (`make_tool_result_message`).
|
| 29 |
+
- U1 parallel dispatch of read-only tools (asyncio.gather, partial-failure
|
| 30 |
+
tolerant): Claude Code/Tool.ts capability-predicate pattern (N27).
|
| 31 |
"""
|
| 32 |
|
| 33 |
from __future__ import annotations
|