commit 4be63e16e85696346655c9c2a25368861c55d126
parent 3bc2a8bfa6bf28ac405fff55023c3dcca7a142c9
Author: triesap <tyson@radroots.org>
Date: Mon, 21 Sep 2026 15:01:37 +0000
provider: add raw-input semantic evaluation runner
Diffstat:
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/pixi.toml b/pixi.toml
@@ -37,6 +37,7 @@ check-format = "sh tools/check_format.sh"
test-architecture = "sh tools/check_architecture.sh --self-test"
smoke-max-local = "mojo -I src -I tests tests/max_local_operator_smoke.mojo"
smoke-jev = "mojo -I src -I tests tests/smoke_jev.mojo"
+eval-jev = "mojo -I src -I tests tests/eval_jev.mojo"
test-runtime-contract = { depends-on = [
"test-runtime",
"test-repo-local-process",
diff --git a/tests/eval_jev.mojo b/tests/eval_jev.mojo
@@ -0,0 +1,51 @@
+from std.os import getenv
+
+from hyf_provider.jev_client import post_jev_systemone
+from hyf_runtime.jev_composition import typesafe_api_key_present
+from hyf_core.normalization.candidates import discover_candidates
+from std.collections import List
+from json import loads, dumps
+
+
+comptime BASE_URL = "https://api.typesafe.ai"
+comptime MODEL = "jev-1.13.0"
+
+
+def main() raises:
+ if getenv("HYF_EVAL_AUTHORIZED", "") != "1":
+ print(
+ "BLOCKED: raw-input semantic evaluation is opt-in; set "
+ "HYF_EVAL_AUTHORIZED=1 with an authorized reviewed corpus."
+ )
+ raise Error("eval_not_authorized")
+ if not typesafe_api_key_present():
+ print(
+ "BLOCKED: evaluation requires TYPESAFE_API_KEY; no external call "
+ "was made."
+ )
+ raise Error("live_jev_prerequisite_missing")
+
+ # Raw-input candidate discovery runs locally first.
+ var products = List[String]()
+ products.append("roma tomatoes")
+ var units = List[String]()
+ units.append("lb")
+ var dates = List[String]()
+ dates.append("friday")
+ var candidates = discover_candidates(
+ "Got about 80 lb of Roma tomatoes. Can deliver Friday.",
+ products,
+ units,
+ dates,
+ )
+ var body = loads(
+ '{"model":"'
+ + MODEL
+ + '","state":"Got about 80 lb of Roma tomatoes. Can deliver Friday.",'
+ + '"questions":{"supply_status":{"type":"choice","instructions":'
+ + '"Is produce reported available?","criteria":{"offered":"yes",'
+ + '"unclear":"no"}}}}'
+ )
+ var outcome = post_jev_systemone(BASE_URL, body, 15000)
+ print("discovered_candidates=" + String(len(candidates)))
+ print("provider_status=" + String(outcome.status))