labs/aicharts: fast non-thinking model for specs (#39)

Live: gemma-4 took 70s+ and returned empty content on harder prompts (budget spent
thinking). Llama 3.3 70B fp8-fast answers the spec directly; still overridable.


Claude-Session: https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva

Co-authored-by: Claude <noreply@anthropic.com>
This commit was merged in pull request #39.
This commit is contained in:
teahubxyzandClaude authored and GitHub committed 2026-10-13 14:01:33 +00:00
1 parent 9e065e416d
commit 3086cb52ff
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ def deploy() -> dict:
sys.exit("CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are needed")
code = parts()
rev = hashlib.sha256(b"".join(d for _, _, d in code)).hexdigest()[:12]
vars_ = {"REV": rev, "AI_MODEL": cf.env("AICHARTS_AI_MODEL", cf.AI_MODEL), "AI_DAILY": cf.env("AICHARTS_AI_DAILY", "300"),
vars_ = {"REV": rev, "AI_MODEL": cf.env("AICHARTS_AI_MODEL", "@cf/meta/llama-3.3-70b-instruct-fp8-fast"), "AI_DAILY": cf.env("AICHARTS_AI_DAILY", "300"),
"SAVE_DAILY": cf.env("AICHARTS_SAVE_DAILY", "1000")}
db = cf.database("aicharts") # named time-aicharts, like the script
meta = {"main_module": "main.js", "compatibility_date": cf.COMPAT,
+1 -1
View File
@@ -162,7 +162,7 @@ export function normalizeSpec(spec) {
// Plain prompt first: the prompt's grammar and example steer small models better than a constrained decoder does (a
// one-size schema for every step made them drop agg and by). JSON mode only when no object came back at all.
async function model(env, messages) {
const input = { messages, max_tokens: 700, temperature: 0.1 };
const input = { messages, max_tokens: 900, temperature: 0.1 };
const text = (out) => out?.response ?? out?.choices?.[0]?.message?.content ?? "";
let raw = text(await env.AI.run(env.AI_MODEL, input));
if (!firstObject(raw)) {